Or something like this

/*                       REXX                                        */
/*%COPYRIGHT (c) copyright LHKAB                                     */
/*                                                                   */
/*
      REXXNAME   :  MACONALL
      System     :  ISPF
      Written    :  2014-03
      By         :  Lars Höglund Konsult AB 
(www.lhkab.com<http://www.lhkab.com>)
      Function   :  Edit, with a macro, all members in a PDS
                    allocated to ddname=PDS

      Related object
      - panel    :  -
      - msg      :  -
      - exec     :  -
      - skels    :  -
      - pgm      :  -

 H I S T O R Y
 -------------
 20xx-xx-xx who    what

*/
  trace o

  signal on syntax                        /* trap rexx syntax errors */
  signal on novalue                   /* trap unititalized variables */
  signal off error    /* handle positive rc command failures in code */
  signal off failure  /* handle negative rc command failures in code */
  signal off halt                  /* allow normal hi/he termination */

  parse upper arg parms

  call B_initialize

  if maconall_rc = 0 then
     call C_mainline

  call X_cleanup

  return maconall_rc

B_initialize :
/*-----------------------------------------------*/
/* Init                                          */
/*-----------------------------------------------*/

  parse source rxenv rxinv me rxdd rxdsn rxname rxhost rxaspc .

  false = 0
  true  = 1

  maconall_rc = 0

  call BZ_create_messages

  call Y_log_process left('-',60,'-')
  call Y_log_process MSG.log_start
  call Y_log_process ''

  parse var parms parm_macro  .
  editmac = strip(parm_macro)

  call Y_log_process MSG.log_parm
  call Y_log_process 'Macro..........:' editmac
  call Y_log_process ''

  return

BZ_create_messages :
BZ_create_messages :
/*-----------------------------------------------*/
/* Create errormessages                          */
/*-----------------------------------------------*/

  log_start = 1
  MSG.log_start = center('Program' me 'starts',60)

  log_parm = 2
  txt = 'S u p p l i e d   P a r a m e t e r s'
  MSG.log_parm  = txt

  log_end = 99
  MSG.log_end   = center('Program' me 'ends',60)

  contact = 'ISPF Administrator'
  terminate = center('** T e r m i n a t i n g **',60)

  return

C_mainline :
/*-----------------------------------------------*/
/* Mainline                                      */
/*-----------------------------------------------*/

  address "ISPEXEC" "LMINIT DATAID(DID1) DDNAME(PDS)"
  address "ISPEXEC" "LMOPEN DATAID("did1")"
  membvar = ' '
  do until rc > 0
     address "ISPEXEC" "LMMLIST",
                       "DATAID("did1")",
                       "OPTION(LIST)",
                       "MEMBER(MEMBVAR)",
                       "STATS(YES)"
     if rc > 0 then
        leave
     if membvar <> 'ÅÅSETUP' then
        do
         address "ISPEXEC" "EDIT",
                           "DATAID("did1")",
                           "MEMBER("membvar")",
                           "MACRO("editmac")"
        end
  end /*do until rc > 0*/

  address "ISPEXEC" "LMMLIST DATAID("did1") OPTION(FREE)"
  address "ISPEXEC" "LMFREE DATAID("did1")"

  return

X_cleanup :
/*-----------------------------------------------*/
/* cleanup                                       */
/*-----------------------------------------------*/

  if maconall_rc > 4 then
     call Z_error ''

  return

Y_log_process :
/*-----------------------------------------------*/
/* Displaying processing status                  */
/*-----------------------------------------------*/
  parse arg text

  say time() left(text,60) me

  do forever
     text = delstr(text,1,60)
     if text = '' then
        leave
     say time() left(text,60) me
  end /*do forever*/

  return

Z_error :
/*-----------------------------------------------*/
/* Errormessage                                  */
/*-----------------------------------------------*/
  parse arg etext

  if etext > ' ' then
     do
      call Y_log_process left('-',60,'-')
      call Y_log_process etext
      call Y_log_process left('-',60,'-')
     end

  call Y_log_process left('-',60,'-')
  call Y_log_process terminate
  call Y_log_process left('-',60,'-')

  exit 8

/*************************************************/
/*                                               */
/* Rexx Error Handling Common Routines           */
/*                                               */
/*************************************************/

syntax:                              /* Signal ON SYNTAX Entry Point */
novalue:                            /* Signal ON NOVALUE Entry Point */
error:                                /* Signal ON ERROR Entry Point */
failure:                            /* Signal ON FAILURE Entry Point */
halt:                                  /* Signal ON HALT Entry Point */
  trace o                                          /* turn trace off */
  parse source . . me .
  signal off novalue        /* Ignore no-value variables within trap */
  trap_errortext = 'Not Present'/* Error text available only with RC */
  trap_condition = Condition('C')              /* Which trap sprung? */
  trap_description = Condition('D')               /* What caused it? */
  trap_rc = rc                          /* What was the return code? */
  if datatype(trap_rc) = 'NUM' then     /* Did we get a return code? */
     trap_errortext = Errortext(trap_rc)    /* What was the message? */
  trap_linenumber = sigl                     /* Where did it happen? */
  trap_line = sourceline(trap_linenumber)  /* What is the code line? */

  ER. = ''                           /* Initialize error output stem */
  ER.1 = 'An error has occurred in Rexx module:' me
  ER.2 = '   Error Type        :' trap_condition
  ER.3 = '   Error Line Number :' trap_linenumber
  ER.4 = '   Instruction       :' trap_line
  ER.5 = '   Return Code       :' trap_rc
  ER.6 = '   Error Message text:' trap_errortext
  ER.7 = '   Error Description :' trap_description
  ER.8 = 'Please report the problem to your' contact
  ER.0 = 8

  do i = 1 to ER.0                   /* Print error report to screen */
     say ER.i
  end /*do i = 1 to ER.0*/

  call Z_error ''

-----Ursprungligt meddelande-----
Från: IBM Mainframe Discussion List <[email protected]> För Lars Höglund
Skickat: den 7 februari 2023 03:49
Till: [email protected]
Ämne: Sv: ISPF macro/script

Look at Marc Zelden's EDMACALL
//Lasse

-----Ursprungligt meddelande-----
Från: IBM Mainframe Discussion List <[email protected]> För Hobart Spitz
Skickat: den 7 februari 2023 03:19
Till: [email protected]
Ämne: Re: ISPF macro/script

You have these options:
1 - Select the member manually, and invoke your REXX edit macro.
2 - Write another module the invokes the edit service in the library and 
member, and runs the edit macro.
3 - Write one dual mode module.  I do not recommend this.

Edit commands are only valid in REXX EXECs that have issued ADDRESS ISREDIT 
MACRO which establishes the edit macro environment.

I would Google "ispf edit macro example".

On Monday, February 6, 2023, Radoslaw Skorupka < 
[email protected]> wrote:

> To be honest ISPF & REXX is not my strong point.
>
> I need the following:
> From PDS(E) member list I type my CMD1, hit ENTER - to start the REXX
> script.
> The script Select new member (name generated from date+consecutive
> character), then issue some edit commands, like COPY TEMPLATE to copy
> some text from the TEMPLATE member.
>
> Any clue?
> Or some similar script to learn by example?
>
> --
> Radoslaw Skorupka
> Lodz, Poland
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions, send
> email to [email protected] with the message: INFO IBM-MAIN
>


--
OREXXMan
Q: What do you call the residence of the ungulate with the largest antlers?
A: A moose pad.
:-D
Would you rather pass data in move mode (*nix piping) or locate mode
(Pipes) or via disk (JCL)?  Why do you think you rarely see *nix commands with 
more than a dozen filters, while Pipelines specifications are commonly over 
100s of stages, and 1000s of stages are not uncommon.
REXX is the new C.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected] with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to