MainframeSupports
tip week 46/2001:

ISPF is a fascinating product that enables us to write home-grown utilities in almost no time. In some areas ISPF is very complicated. For instance it is fairly easy to make your own ISPF-command, but it is a complicated task to make it work for everybody no matter where in ISPF they are. This tip describes a short cut method for making something that works like an ISPF-command, but only in ISPF EDIT/VIEW sessions.

The trick is that so-called EDIT-macroes are activated as if they were ISPF-commands. We will take advantage of this in the following way:

/* REXX */
/* MY NAME IS: ISPFTRIK */
ARG PARM

ADDRESS ISREDIT "MACRO (PARM)"
IF RC = 0
THEN DO
  PARM = TRANSLATE(PARM)
END

SAY "PARAMETER = " !! PARM
EXIT

In this piece of REXX the five lines of code in the middle are completely obsolete. Try to execute it as an EDIT-macro without those five lines, and you will know their significance.

If you don't have to use a parameter then omit the five lines. If you don't wan't any upper case translation, then use PARSE ARG PARM instead of ARG PARM and drop the contens of the DO block. If you wan't to use more than one parameter then the parameter list in the MACRO statement has to match the list in the ARG statement. You must remember to code a TRANSLATE assignment for each parameter in the parameter list, if you want uppercase translation. And don't use more than eight characters in the variable names of the parameters, because ISPF-macroes cannot deal with longer variable names.

The good thing about ISPFTRIK is that it works exactly the same way when it is invoked with TSO ISPFTRIK as when it is invoked as an EDIT-macro with command ISPFTRIK in an EDIT/VIEW session. A neat feature is the test of RC after the MACRO call which makes it possible to distinct between the method of invocation. And the best part is that you avoid all the tricky ISPF command table stuff. Just remember that it only works like an ISPF-command in an EDIT/VIEW session. Everywhere else you will have to type in TSO in front of the command name.

Previous tip in english        Sidste danske tip        Tip list