MainframeSupports
tip week 19/2015:

In the user group someone asked about how to convert a REXX using ISPF variables into a HLASM program. Such a conversion involves the usage of VDEFINE and VDELETE which I have previously written about. I am not a master of assembler, but I think an example of rewriting from REXX to PLI might help.

First of all you will probably ask what benefits could be acheived by using PLI or COBOL instead of REXX. My answer is that normally there is no obvious benefits unless your REXX is running slowly. Then a rewrite to PLI or COBOL will help significantly. Improvements in elapsed time in factors of 10 to 100 times are not unusual.

I will start by showing you a litte REXX program that prints the contents of an ISPF variable stored in the ISPF pool:

/* REXX */
ARG ISPFVAR
ADDRESS TSO ISPEXEC "VGET "ISPFVAR
SAY ISPFVAR' = 'VALUE(ISPFVAR)
EXIT

Four lines of code is all it takes. The VALUE function converts the name in ISPFVAR into a variable name and hence it is the value of the name of the variable stored in ISPFVAR that is printed instead of the contents of ISPFVAR. Please notice that when you make a VGET of just one variable you are not required to put it in parenthesis.

The following PLI program does exactly the same as the above REXX:

cemtip: PROC(parm) OPTIONS(MAIN) REORDER;

DCL parm CHAR(100) VAR;

DCL isplink EXT ENTRY OPTIONS(ASM INTER RETCODE);
DCL myispfvar CHAR(256);
DCL ispfvar CHAR(8);

ispfvar = parm;
CALL isplink('VDEFINE ', ispfvar, myispfvar, 'CHAR ', stg(myispfvar));
CALL isplink('VGET ', ispfvar);
PUT SKIP LIST(ispfvar !! ' = ' !! myispfvar);
CALL isplink('VDELETE ', ispfvar);

END cemtip;

The PLI program fills three times more lines and in order to retrieve the contents of the variable specified as input in PARM you have to execute a VDEFINE. Before termination of the program you need to execute a VDELETE. All the ISPEXEC calls you perform in REXX can be translated to a corresponding ISPLINK call. The translation is available in ISPF Services Guide. Everywhere in REXX where you use a REXX variable as an ISPF variable you need to make a suitable VDEFINE in PLI and a corresponding PLI variable.

Previous tip in english        Forrige danske tip        Tip list