passing value from REXX to JCL in batch mode

IBM's Command List programming language & Restructured Extended Executor

passing value from REXX to JCL in batch mode

Postby chinkump » Thu Apr 11, 2013 1:29 am

Consider a job which has following steps.

//Step1 Exec pgm1=ABC
//Step2 --------------REXX program
//Step3 Exec pgm2=DEF

My requirement is to run Step3 if the Return code of Step2 REXX program is equal to 0.

Currently whatever may be the result of Step 2 Step 3 is getting executed. Please let me know if there is any method to pass the returncode from REXX program to jcl and then running the Step 3.

Posts: 26
Joined: Fri Jan 20, 2012 10:48 pm
Has thanked: 3 times
Been thanked: 0 time

Re: passing value from REXX to JCL in batch mode

Postby Akatsukami » Thu Apr 11, 2013 1:47 am

Very simple.

//(other DD statements as needed)
//IF1      IF   (RC.STEP2=0) THEN
//(DD statements as needed)

End FOO with an exit someval statement, someval being the return code, either a literal or a value (remember that it must be a decimal number in the range 0-4095).
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day

These users thanked the author Akatsukami for the post:
chinkump (Thu Apr 11, 2013 1:57 am)
User avatar
Global moderator
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: passing value from REXX to JCL in batch mode

Postby dick scherrer » Thu Apr 11, 2013 7:40 pm


You do not "pass" a value. When a step ends, a Return Code may be set and checked in subsequent steps.

Suggest you read about COND= in the JCL Reference Manual (link to IBM Manuals at the top of the page).
Hope this helps,
User avatar
dick scherrer
Global moderator
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Return to CLIST & REXX


  • Related topics
    Last post