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


ISRBOX macro

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

The ISRBOX macro draws a box with its upper left corner at the cursor position. This macro comes in handy when you want to make a note to yourself or others reading the data. You can start the ISRBOX macro in one of two ways:
  • Type ISRBOX on the command line as an edit primary command and press Enter.
  • Type KEYS on the command line, press Enter, set a function key to the ISRBOX macro, and enter the END command.

If you have defined a function key for ISRBOX, position the cursor on a data line where you want the box drawn. Press the function key that you have defined to start the ISRBOX macro. After the box is drawn, the cursor is positioned inside, ready for you to type enough text to fill the box.

If any of the macro commands fail, a warning message appears.

Figure 1. ISRBOX macro
/*********************************************************************/
/*                                                                   */
/* 5647-A01 (C) COPYRIGHT IBM CORP 1995, 2003                        */
/*                                                                   */
/* ISRBOX - Draw a box with its upper left corner at the             */
/*          cursor position                                          */
/*                                                                   */
/*********************************************************************/
ISREDIT MACRO
ISREDIT (ROW,COL) = CURSOR             /* Get cursor position     */

ISPEXEC CONTROL ERRORS RETURN          /* No macro error panel    */
                                       /* Draw box over existing  */
                                       /*    lines                */

ISREDIT LINE &ROW          = LINE + < &COL '+--------------------+'>
ISREDIT LINE &EVAL(&ROW+1) = LINE + < &COL '|                    |'>
ISREDIT LINE &EVAL(&ROW+2) = LINE + < &COL '|                    |'>
ISREDIT LINE &EVAL(&ROW+3) = LINE + < &COL '|                    |'>
ISREDIT LINE &EVAL(&ROW+4) = LINE + < &COL '|                    |'>
ISREDIT LINE &EVAL(&ROW+5) = LINE + < &COL '+--------------------+'>

IF &MAXCC > 0 THEN DO                  /* If error occurred while */
   SET ZEDSMSG = &STR(INCOMPLETE BOX)  /*    overlaying lines     */
   SET ZEDLMSG = &STR(NOT ENOUGH LINES/COLUMNS TO DRAW COMPLETE BOX)
   ISPEXEC SETMSG MSG(ISRZ001)         /* Issue error message     */
END

SET &COL = &COL + 2                    /* Position cursor within  */
SET &ROW = &ROW + 1                    /*    the box              */
ISREDIT CURSOR = (ROW,COL)
EXIT CODE(0)

This list explains the logical sections of the ISRBOX macro:

  1. The variables &ROW and &COL are set to the cursor position.
    ISREDIT (ROW,COL) = CURSOR
  2. The dialog service allows the macro to handle severe errors, allowing a message to be displayed when the cursor is placed too close to the end of the data. The LINE assignment statement fails if the row it is setting does not exist.
    ISREDIT CONTROL ERRORS RETURN
  3. The LINE assignment statements overlay existing data on a line with the characters which form a box. LINE uses a merge format to include the existing line data and then a template to put the overlaying data at the cursor column position. The CLIST &EVAL function increments the relative line numbers before the statement is passed to the editor.
    ISREDIT LINE &ROW          = LINE + < &COL '+----------------+'>
    ISREDIT LINE &EVAL(&ROW+1) = LINE + < &COL '|                |'>
    ISREDIT LINE &EVAL(&ROW+2) = LINE + < &COL '|                |'>
    ISREDIT LINE &EVAL(&ROW+3) = LINE + < &COL '|                |'>
    ISREDIT LINE &EVAL(&ROW+4) = LINE + < &COL '|                |'>
    ISREDIT LINE &EVAL(&ROW+5) = LINE + < &COL '+----------------+'>
  4. The CLIST IF statement checks the &MAXCC variable, and if it is nonzero, calls the dialog service SETMSG to display a message. &MAXCC is a variable updated by the CLIST processor to contain the highest condition code.
    IF &MAXCC > 0 THEN
  5. The message used in SETMSG is one of two messages (ISRZ000 and ISRZ001) reserved for macro use. Each message uses two variables:
    • &ZEDSMSG to set the text for the short message (up to 24 characters) that is displayed when the macro ends.
    • &ZEDLMSG to set the text for the long message that appears when the HELP command is entered.
    Message ISRZ001 sounds the alarm to indicate an error; message ISRZ000 does not sound the alarm.
      DO
        SET ZEDSMSG = &STR(INCOMPLETE BOX)
        SET ZEDLMSG = &STR(NOT ENOUGH LINES/COLUMNS +
        TO DRAW COMPLETE BOX)
        ISPEXEC SETMSG MSG(ISRZ001)
      END
  6. These statements position the cursor within the box to simplify entering text when the panel is redisplayed.
    SET &COL = &COL + 2
    SET &ROW = &ROW + 1
    ISREDIT CURSOR = (ROW,COL)
This example shows the cursor placed on line 000009 next to the number 9 before starting the macro.
Figure 2. ISRBOX macro - before running
   File  Edit  Edit_Settings  Menu  Utilities  Compilers  Test  Help
 ───────────────────────────────────────────────────────────────────────────────
 EDIT       SBURNF.PRIVATE.DATA(TESTDATA) - 01.00           Columns 00001 00072
 Command ===> isrbox                                           Scroll ===> CSR 
 ****** ***************************** Top of Data ******************************
 000100 TEST-1
 000200 TEST-2
 000300 TEST-3
 000400 TEST-4
 000500 TEST-5
 000600 TEST-6
 000700 TEST-7
 000800 TEST-8
 000900 TEST-9_
 001000 TEST-#
 001100 TEST-#
 001200 TEST-#
 001300 TEST-#
 001400 TEST-#
 001500 TEST-#
 ****** **************************** Bottom of Data ****************************

  F1=Help      F2=Split     F3=Exit      F5=Rfind     F6=Rchange   F7=Up
  F8=Down      F9=Swap     F10=Left     F11=Right    F12=Cancel
When you press Enter, a box appears beside the cursor.
Figure 3. ISRBOX macro - after running
   File  Edit  Edit_Settings  Menu  Utilities  Compilers  Test  Help
 ───────────────────────────────────────────────────────────────────────────────
 EDIT       SBURNF.PRIVATE.DATA(TESTDATA) - 01.00           Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR 
 ****** ***************************** Top of Data ******************************
 000100 TEST-1
 000200 TEST-2
 000300 TEST-3
 000400 TEST-4
 000500 TEST-5
 000600 TEST-6
 000700 TEST-7
 000800 TEST-8
 000900 TEST-9+--------------------+
 001000 TEST-#| _                  |
 001100 TEST-#|                    |
 001200 TEST-#|                    |
 001300 TEST-#|                    |
 001400 TEST-#+--------------------+
 001500 TEST-#
 ****** **************************** Bottom of Data ****************************

  F1=Help      F2=Split     F3=Exit      F5=Rfind     F6=Rchange   F7=Up
  F8=Down      F9=Swap     F10=Left     F11=Right    F12=Cancel

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014