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


Using CLIST WRITE statements and REXX SAY statements

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

The CLIST WRITE statement and the REXX SAY statement can be valuable tools in tracking down edit macro problems. A WRITE statement or a SAY statement is simply a line of text inserted into your macro that creates a message on your screen while the macro is running. With these statements, you can identify the position of the statement within the macro, and display the value of variables.

For example, if you are having trouble debugging the CLIST ISRTDATA macro from Figure 1, adding some WRITE statements may help locate the problem.

Figure 1. ISRTDATA macro with CLIST WRITE statements
/*********************************************************************/
/*                                                                   */
/* 5647-A01 (C) COPYRIGHT IBM CORP 1995, 2003                        */
/*                                                                   */
/* ISRTDWRI - generates test data                                    */
/*                                                                   */
/*********************************************************************/
ISREDIT MACRO
  SET &COUNT = 1                    /* Initialize loop counter    */
  DO WHILE &COUNT <= 9              /* Loop up to 9 times         */
    ISREDIT FIND 'TEST-#'           /* Search for 'TEST-#'        */
    SET &RETCODE = &LASTCC          /* Save the FIND return code  */
    WRITE RESULT OF FIND, RC = &RETCODE
    IF &RETCODE = 0 THEN            /* If string was found,       */ -
      DO                            /*                            */
        ISREDIT CHANGE '#' '&COUNT' /*   Change # to a digit and  */
        SET &COUNT = &COUNT + 1     /*   increment loop counter   */
        WRITE COUNT IS NOW UP TO &COUNT
      END                           /*                            */
    ELSE                            /* If string is not found,    */ -
      SET &COUNT = 10               /*   Set counter to exit loop */
  END
EXIT CODE (0)

Remember that the macro ISRTDATA creates test data with variations of the same line by putting ascending numbers 1 through 9 in the data. When WRITE statements are included in the data, a step-by-step breakdown of the procedure appears on your screen.

If there are no errors in the ISRTDATA macro, the return codes and count appear on your screen in TSO line mode. Asterisks at the bottom of the screen prompt you to press Enter and return to ISPF full-screen mode (Figure 2).

Figure 2. Results of ISRTDATA macro with CLIST WRITE statements
 RESULT OF FIND, RC = 0
 COUNT IS NOW UP TO 2
 RESULT OF FIND, RC = 0
 COUNT IS NOW UP TO 3
 RESULT OF FIND, RC = 0
 COUNT IS NOW UP TO 4
 RESULT OF FIND, RC = 0
 COUNT IS NOW UP TO 5
 RESULT OF FIND, RC = 0
 COUNT IS NOW UP TO 6
 RESULT OF FIND, RC = 0
 COUNT IS NOW UP TO 7
 RESULT OF FIND, RC = 0
 COUNT IS NOW UP TO 8
 RESULT OF FIND, RC = 0
 COUNT IS NOW UP TO 9
 RESULT OF FIND, RC = 0
 COUNT IS NOW UP TO 10
  ***_

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014