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


ISRIMBED macro

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

The ISRIMBED macro (Figure 1) builds a list of imbed (.im) statements found in the member that is entered as an operand. The list is created at the end of the member currently being edited. The imbed statements are indented under a MEMBER identifier line.

You can start this macro by editing a member, typing ISRIMBED and the name of the member that contains the imbed statements as the operand, and pressing Enter.

Figure 1. ISRIMBED macro
/*********************************************************************/
/*                                                                   */
/* 5647-A01 (C) COPYRIGHT IBM CORP 1995, 2003                        */
/*                                                                   */
/* ISRIMBED - creates a list of imbed statements.                    */
/*                                                                   */
/*********************************************************************/
ISREDIT MACRO (MEMBER)                   /* Member name passed  */
                                         /*   as input          */
ISREDIT LINE_AFTER .ZL='MEMBER &MEMBER'  /* Add member ID line  */
ISREDIT (LINENBR) = LINENUM .ZL          /* Get line number     */

ISREDIT COPY AFTER .ZL &MEMBER           /* Copy member at end  */
ISREDIT (NEWLL) = LINENUM .ZL            /* Get new last line#  */

IF &LINENBR = &NEWLL THEN                /* If no data was      */ -
   EXIT CODE(8)                          /*   copied, then exit */
ELSE DO
   ISREDIT LABEL &EVAL(&LINENBR + 1) = .FIRST  /* Label first   */
                                         /*   line copied       */
   ISREDIT RESET EXCLUDED                /* Make sure there are */
                                         /*   no previously     */
                                         /*   excluded lines    */

   ISREDIT EXCLUDE ALL .FIRST .ZL        /* Exclude newly       */
                                         /*   copied lines      */
   ISREDIT FIND ALL .IM 1 .FIRST .ZL     /* Show lines          */
   SET FINDRC = &LASTCC                  /*   containing ".im"  */
                                         /*   in column 1       */
   ISREDIT DELETE ALL X .FIRST .ZL       /* Delete any lines    */
                                         /*   still excluded    */
   ISREDIT (NEWLL) = LINENUM .ZL         /* Update last line    */
                                         /* number after delete */
   IF &FINDRC = 0 THEN                   /* If ".im" was found  */ -
     DO WHILE (&LINENBR < &NEWLL)        /*   for all remaining */
                                         /*   copied lines      */
       SET LINENBR = &LINENBR + 1        /*   Shift all .im     */
       ISREDIT SHIFT &LINENBR ) 8        /*   lines right 8     */
     END
END
EXIT CODE(1)                             /* Place cursor on     */
                                         /*   command line      */

This list explains the logical sections of the ISRIMBED macro:

  1. Add a line that identifies the member to be searched at the end of ISRIMBED. The .ZL (or .ZLAST) is always associated with the last line in the data.
    ISREDIT LINE_AFTER .ZL = 'MEMBER &MEMBER'
  2. Retrieve the line number of the identifier line just added into &LINENBR.
    ISREDIT (LINENBR) = LINENUM .ZL
  3. Now copy, at the end of ISRIMBED, the member name that was passed as an input parameter.
    ISREDIT COPY AFTER .ZL &MEMBER
  4. &NEWLL is set to the new last line number of ISRIMBED.
    ISREDIT (NEWLL) = LINENUM .ZL
  5. Check to see if any lines were added by the copy. Exit from the macro if no lines were added.
    IF &LINENBR = &NEWLL THEN
        EXIT CODE(8)
  6. Set the .FIRST label on the first line copied. This label is available only to this macro; you do not see it.
    ISREDIT LABEL &EVAL(&LINENBR + 1) = .FIRST
  7. Excluded lines are deleted later. Therefore, make sure that no lines in the data set are excluded.
    ISREDIT RESET EXCLUDED
  8. Exclude all lines that were just copied: all the lines in the range .FIRST to .ZL.
    ISREDIT EXCLUDE ALL .FIRST .ZL
  9. The FIND command is used to find all occurrences of .im starting in column 1 of the copied lines. This shows (unexcludes) the lines to keep. If .im was not found on any line, &FINDRC will be 4.
    ISREDIT FIND ALL .IM 1 .FIRST .ZL
    SET FINDRC = &LASTCC
  10. All the lines still excluded are now deleted.
    ISREDIT DELETE ALL X .FIRST .ZL
  11. Obtain the last line number again, because it will have changed if lines were deleted.
    ISREDIT (NEWLL) = LINENUM .ZL
  12. If .im lines were found, loop using a column shift to indent them under the member identifier line. Note that &LINENBR is still associated with the identifier line.
    IF &FINDRC = 0 THEN
       DO WHILE (&LINENBR < &NEWLL)
          SET LINENBR = &LINENBR + 1
          ISREDIT SHIFT &LINENBR ) 8
               END
LIST is a member with several imbed statements.
Figure 2. LIST with imbed statements
Screen dump.
When you run the ISRIMBED macro by typing ISRIMBED LIST on the command line of ISRTDATA, a list of the imbeds in LIST appears at the end of the data. See Figure 3.
Figure 3. ISRIMBED macro - after running
Screen dump.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014