Question

Can we pass arguments to a REXX program from JCL?

I suppose, JCL PARM can be used as we use for passing arguments to COBOL programs.. Do put your ideas here...

Was it helpful?

Solution

You want EXEC PGM=IRXJCL,PARM='member_name exec_args'. SYSEXEC should point to the PDS containing member name. SYSTSIN is the input for PULL, SYSTSPRT is the output DD for SAY

Check out the "Using REXX in TSO/E and Other MVS Address Spaces" chapter in the "TSO/E Rexx User Guide" book (SA22-7791) for a full example.

OTHER TIPS

An added note: If your REXX exec uses ISPF services, you can run it in batch with PGM=IKJEFTxx (xx being a variable suffix) and allocating ISPxLIB in the job step.

If the parameters together with the REXX member name exceeds 100 bytes, the method mentioned by Ron Patterson won't work as JCL syntax only allows a maximum paramater length of 100 bytes. In this case I recommend using IKJEFTxx (already posted by Tony). You then have to pass the REXX program name as instream data to SYSTSIN. The parameters to this program can simply written behind the program name. When you need more than one line, use the hyphen as last character of a line to indicate the concatenation with the following line. Example:

//EXAMPLE  EXEC PGM=IKJEFT01,REGION=4096K,DYNAMNBR=30
//SYSPRINT DD  SYSOUT=*                              
//SYSEXEC  DD  DISP=SHR,DSN=YOUR.REXX.LIBRARY    
//SYSTSPRT DD  SYSOUT=*                              
//SYSTSIN  DD  *                                     
  SCHLABB PARAMETER1 PARAMETER2 PARAMETER3 -
          VERY_LONG_PARAMETER4             -
          LAST_PARAMETER5                                
/*                                                   
//                                                   

I was getting RC (-3) for basic EXECIO, LIBDEF, commands when I tried running IRXJCL. I wish there was better documentation on what IRXJCL can and can not do.

Finally followed the approach from the below link, to dynamically pass values to a REXX by writing them to a file and reading from the file. How to run dymanic SQL through IKJEFT01 Utility?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top