0

I am executing a MACRO to find string (using regular expression), and want to handle the return code of that regular expression execution in my caller REXX in mainframe. I tried using PARM and, VGET and VPUT, but no positive result for me.

/* REXX */
ADDRESS ISPEXEC "VPUT (MRC) SHARED"
ADDRESS ISPEXEC "VIEW DATASET('XXXX.XXXX.XXXX') MACRO(REGEX)
SAY "RC IN CALLER:" RC
SAY "MRC:" MRC

Macro defined:

/* REXX */
ADDRESS ISREDIT
"MACRO"
ADDRESS ISPEXEC "VGET (MRC) SHARED"
"F RC'[0-9]{16}'"
MRC = RC
SAY "INSIDE MACRO:" MRC
ADDRESS ISREDIT 'END'

Also tried reversing VGET and VPUT in macro and caller REXX and also changes the place of the statement. Still no result.

Output:

INSIDE MACRO: 0 (when string found)
RC IN CALLER: 0
MRC: 

INSIDE MACRO: 4 (when string not found)
RC IN CALLER: 0
MRC:

Could any one please suggest.

S. Agrawal
  • 79
  • 1
  • 8
  • You VPUT MRC once you have established it value and then VGET it after you have returned from the macro. Your snippet shows neither of these things. If you have tried that then how about running a trace to see what is going on? – NicC Nov 26 '19 at 10:55
  • Thanks @NicC , the sequence you mentioned to use VPUT and VGET worked, and the way you explained clear the doubt. – S. Agrawal Nov 26 '19 at 11:46
  • The ISPF 'MODEL' command can be very helpful for developing ISPF applications - simply enter MODEL on the edit command line and 'A' on the line after which you want to insert a new ISPF command - it will bring up a panel where you select the command you want and then insert a model of that command with parameters and return values etc. – Steve Ives Nov 27 '19 at 13:15

0 Answers0