z/OS ISPF Edit and Edit Macros
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


ISRMBRS macro

z/OS ISPF Edit and Edit Macros
SC19-3621-00

The ISRMBRS macro (Figure 1) uses PDF library access services to determine each member name in the library being edited.

This macro invokes the edit service for each member in the library, except the member currently being edited, passing a user-specified edit macro on the edit service invocation. The ISRMBRS macname command, where macname is the name of the macro to be invoked against each member, starts the service.

This macro can aid in making repetitive changes to all members of a data set, or in searching all members for a specific string of data.

Figure 1. ISRMBRS macro
/*REXX****************************************************************/
/*   ISPF edit macro to process all members of partitioned data set, */
/*   running a second, user-specified, ISPF edit macro against each  */
/*   member.                                                         */
/*                                                                   */
/*   To run:                                                         */
/*    Enter "ISRMBRS macname" on the command line, where macname is  */
/*    the macro you want run against each member.                    */
/*********************************************************************/

'ISREDIT MACRO (NESTMAC)'

/*********************************************************************/
/* Get dataid for data set and issue LMOPEN                          */
/*********************************************************************/
'ISREDIT (DATA1) = DATAID'
'ISREDIT (CURMEM) = MEMBER'
Address ispexec 'LMOPEN DATAID('data1') OPTION(INPUT)'
member = ' '
lmrc = 0

/*********************************************************************/
/* Loop through all members in the PDS, issuing the EDIT service for */
/* each.  The macro specified on the ALLMEMS invocation is passed as */
/* an initial macro on the EDIT service call.                        */
/*********************************************************************/
Do While lmrc = 0
  Address ispexec 'LMMLIST DATAID('data1') OPTION(LIST),
                  MEMBER(MEMBER) STATS(NO)'
  lmrc = rc
  If lmrc = 0 & member ^= curmem Then
    do
      Say 'Processing member' member
      Address ispexec 'EDIT DATAID('data1') MEMBER('member')
                      MACRO('nestmac')'
    end
End

/*********************************************************************/
/* Free the member list and close the dataid for the PDS.            */
/*********************************************************************/
Address ispexec 'LMMLIST DATAID('data1') OPTION(FREE)'
Address ispexec 'LMCLOSE DATAID('data1')'

Exit 0
 

To start the ISRMBRS macro, edit a new or existing member and enter ISRMBRS macname, where macname is the name of the macro you wish to invoke against each member of the data set. For example, if the macro is named ISRIMBED, enter: ISRMBRS ISRIMBED

This list explains the logical sections of the ISRMBRS macro:

  1. The MACRO command identifies NESTMAC as the variable to contain the name of the macro that is passed on the edit service invocation for each member. If no parameter is passed to ISRMBRS, NESTMAC is blank.
         ISREDIT MACRO (NESTMAC)
  2. The DATAID assignment statement returns a data ID in the variable DATA1. The data ID identifies the concatenation of data sets currently being edited.
         ISREDIT (DATA1) = DATAID
  3. The name of the member currently being edited is returned in CURMEM.
         ISREDIT (MEMBER) = CURMEM
  4. The data set (or sets) identified by the data ID obtained earlier is opened for input to allow the LMMLIST service to be called later. No return code checking is done because it is presumed that if the data set is being edited, it can be successfully processed by LMOPEN.
     Address ispexec 'LMOPEN DATAID('data1') OPTION(INPUT)'
  5. The variable to hold the name of the next member to be processed, and the return code from the LMMLIST service are initialized.
         member = ' '
         lmrc = 0
  6. The exec loops to process all members returned by LMMLIST. Variable LMRC is set to 4 when the end of the member list is reached, stopping the loop.
         Do While lmrc = 0
  7. Obtain the next member in the list. If this is the first invocation of LMMLIST, the first member in the list is returned. The member name is returned in variable MEMBER, and variable LMRC is set to the return code from LMMLIST.
         Address ispexec 'LMMLIST DATAID('data1') OPTION(LIST),
                         MEMBER(MEMBER) STATS(NO)'
         lmrc = rc
  8. If LMMLIST returns a 0, indicating a member name was returned, and if the member returned is not the member currently being edited, the member is processed.
         If lmrc = 0 Then
           do
  9. The REXX SAY statement is used to write line-I/O messages. As the macro processes each member, the member name appears on the terminal to keep you informed about what is happening. An alternative to the SAY statement would be to display a panel showing the member name after issuing the ISPEXEC CONTROL DISPLAY LOCK service.
         Say 'Processing member' member
  10. The EDIT service is invoked on the member returned by LMMLIST. The macro specified on invocation of ISRMBRS is passed as an initial macro on the edit service.
         Address ispexec 'EDIT DATAID('data1') MEMBER('member')
                         MACRO('nestmac')'
  11. When the LMMLIST service returns a nonzero value, the loop is exited and the cleanup begins. LMMLIST is called to free the member list, and the LMCLOSE service is called to close the data sets associated with the data ID.
         Address ispexec 'LMMLIST DATAID('data1') OPTION(FREE)'
         Address ispexec 'LMCLOSE DATAID('data1')'

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014