MainframeSupports
tip week 41/2010:

In the previous english tip I promised to return to the subject of setting the return code when using ISPSTART. To accomplish this task you must assign the required return code to the ISPF variable ZISPFRC if you want a return code not equal to zero. It is not a simple taks to assing a value to ZISPFRC from COBOL or PL/I. Here is a PL/I procedure that you can use for assigning values to ZISPFRC:

setIspfRC: proc(ispfRc);

dcl ispfRC fixed bin(15);
dcl ispfReturnCode pic'(8)9';
dcl isplink ext entry options(asm inter retcode);
ispfReturnCode = ispfRC;
call isplink('VREPLACE', 'ZISPFRC ', bin(8,31), ispfReturnCode);
call isplink('VPUT ', 'ZISPFRC ', 'SHARED ');

end setIspfRC;

If you prefer to use COBOL you might find some help in tip 41/2006. The first thing I find strange is that ZISPFRC must be declared as a PIC'(8)9' (COBOL: PIC 9(8)). Why not as a FIXED BIN(15). The next strange thing happens when you issue a CALL setIspfRC(20), because you will see that ISPSTART instead returns a return code of 12. At least I cannot make it return anything but 12 when I set ZISPFRC > 12. What a weird limitation.

ISPSTART will not return the value of ZISPFRC unless it is placed in the socalled shared pool. This is what the VPUT does for you. In order to transfer the value of ZISPFRC from your program to ISPF you have to tell ISPF in which variable you have stored the value. This is traditionally done using a VDEFINE, but when you just need to write the value to ISPF you may use VREPLACE instead.

Previous tip in english        Sidste danske tip        Tip list