ISRMBRS macro
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.
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:
- 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)
- 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
- The name of the member currently being edited is returned in CURMEM.
ISREDIT (MEMBER) = CURMEM
- 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)'
- 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
- 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
- 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
- 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
- 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
- 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')'
- 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')'