Page 1 of 1

passing value from REXX to JCL in batch mode

PostPosted: Thu Apr 11, 2013 1:29 am
by chinkump
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.

Thanks,
Chinkump

Re: passing value from REXX to JCL in batch mode

PostPosted: Thu Apr 11, 2013 1:47 am
by Akatsukami
Very simple.

//STEP2    EXEC PGM=IKJEFT1B
//SYSTSIN  DD   *
  EX %FOO
//(other DD statements as needed)
//IF1      IF   (RC.STEP2=0) THEN
//STEP3    EXEC PGM=DEF
//(DD statements as needed)
//ENDIF1   ENDIF

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).

Re: passing value from REXX to JCL in batch mode

PostPosted: Thu Apr 11, 2013 7:40 pm
by dick scherrer
Hello,

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).