Page 1 of 1

Invoking REXX thru JCL passing variables

PostPosted: Thu May 04, 2017 1:50 am
by gpessine
Hi guys!

I have the following problem: I have a JCL which has 2 variables: &DB and &TS, which is passed by the PROC that calls it.

Now I need to call a REXX program, passing these variables &DB and &TS so the program will create a member with this information on it.

However, I do not know how to call the REXX, since the examples I found have the paramenter between quotes, and if I put something like

//STEP1 EXEC PGM=IRXJCL,PARM='MYEXEC &DB &TS'

it won't recognize &DB and &TS as variables, not replacing the text with the values itself.

Can anyone help me?

Re: Invoking REXX thru JCL passing variables

PostPosted: Thu May 04, 2017 2:35 am
by Robert Sample
Using the coding requirements in the JCL Reference manual, it's working fine for me:
1 //RLSTEST  JOB  (10100000),RSAMPLE,CLASS=S,MSGCLASS=8              
   //*        RESTART=STEP13,COND=(0,LE)                              
   //*                                                                
 2 // SET DB=XYZ                                                      
 3 // SET TS=ABCDEFG                                                  
 4 //STEP1    EXEC PGM=IEFBR14,                                      
   // PARM='MYEXEC &DB &TS'                                          
   IEFC653I SUBSTITUTION JCL - PGM=IEFBR14,PARM='MYEXEC XYZ ABCDEFG'  
The requirements listed are (emphasis added by me):
You can code symbols in apostrophes on the following keywords:
•The DD statement AMP parameter
•The DD statement PATH parameter
•The DD statement SUBSYS parameter
•The EXEC statement ACCT parameter
•The EXEC statement PARM parameter.

When you specify these parameters, the system regards a string beginning with an ampersand (&) inside the apostrophes as a symbol when the following conditions are true:
•The character following the ampersand is not another ampersand.
•The characters following the ampersand are ended by a character that is not alphabetic, numeric, or national. The ending character must be not more than 9 characters after the ampersand. The symbol cannot be more than 8 characters long.
•The string of characters delimited by the & (ampersand) character and the ending character is:
Defined as a symbol on a PROC, EXEC, or SET statement
◦A system symbol.


Re: Invoking REXX thru JCL passing variables

PostPosted: Fri May 05, 2017 4:12 am
by Pedro
This worked for me:
//PSV02   JOB ,                                              
//   USER=PEDRO,NOTIFY=PEDRO,TIME=(,59),MSGCLASS=H,REGION=16M
//*                                                          
//REXXPR PROC   DB=DB1,TS=TS1                                
//*                                                          
//STEP2    EXEC PGM=IRXJCL,PARM='TESTPARM &DB &TS'            
//SYSEXEC  DD DSN=PEDRO.CLIST.CLIST,DISP=SHR                  
//SYSTSPRT DD SYSOUT=*                                        
//SYSPRINT DD SYSOUT=*                                        
//SYSOUT   DD SYSOUT=*                                        
//SYSTSIN  DD DUMMY                                          
//*                                                          
//       PEND                                                
//*                                                          
//PSV2TSO     EXEC REXXPR,DB=MYDB,TS=MYTS                    


Can you show us your job? And the proc if it is separate.

Re: Invoking REXX thru JCL passing variables

PostPosted: Fri May 05, 2017 5:23 am
by gpessine
Hi guys

It worked as in your example. Thanks a lot for your help!