MainframeSupports
tip week 50/2003:

I have made a lot of tips using REXX where I have used a simple error routine displaying a message using SAY. It is in fact quite easy to issue an ISPF message instead. I think a lot of you regards ISPF messages as difficult to set up, because you need a member containing one or more messages and all the messages has to confirm to a clumsy naming standard including parts of the member name. And to top it all the member has to be located in a dataset concatenated to DD name ISPMLIB.

If you think ISPF messages are lousy to use I can only say: You are right. Many of us can see the benefits of separating message texts from program code, but why implement such a lousy solution. Fortunately someone inside IBM realized that ISPF messages were built in a particularly annoying way. This person made a general message that we all can benefit from. Just look at the following REXX:

/* REXX: ISPFMSG */
CALL ISPF_MESSAGE 'Short message',,
                  'This is the long message'
EXIT
ISPF_MESSAGE:
  PARSE ARG ZERRSM, ZERRLM
  ZERRALRM = 'YES'
  ZERRHM = '*'
  ADDRESS ISPEXEC "SETMSG MSG(ISRZ002)"
RETURN

This is very simple indeed. ZERRSM is assigned the value of the text you want in the upper right corner of the screen. ZERRLM is assigned the value of a more explanatory text, which is shown when you press the HELP key (normally PF1). ZERRHM is assigned the name of an ISPF panel, which is shown when you press HELP again. * means that the general ISPF tutorial panel is shown. ZERRALRM is assigned either YES or NO. YES means that the terminal should issue a beep when the message is shown and the message text will appear in yellow (if standard ISPF colours are used). When all these four variables has been assigned a value you just call the SETMSG service with the parameter MSG(ISRZ002) and the message you have set up will be shown on the next ISPF panel to be displayed.

I have made a little subroutine which set up the message. Then I can concentrate on filling in the values of the short and long message in the program code. The setting of the alarm and the additional help panel can be decided once for all messages in your program.

If you are wondering about why I use PARSE ARG instead of ARG in the subroutine I can tell you that ARG implicitly carries out an upper case translation.

Previous tip in english        Sidste danske tip        Tip list