Reputation: 73
i heared that JCL returtn code always have the highest return value. ex:
when step 1 ends with 1
step ends with 0
step3 ends with 0
when i want to execute step4 and the return value from the JCL(maximum code which is 1 in the example cae) has to be sent to SAS code which is called from stp 4 for processing is it possible?
can any one help me !!!!
Upvotes: 1
Views: 1634
Reputation: 10543
As Bill stated you can not pass a return code from a previous step to a program in JCL.
Bill is asking why you want to pass the return code to your program
Options you have include:
Using the JCL if statement see JCL IF examples or cond option basically:
// IF (RC = 1) THEN
// EXEC PGM=MyProg,PARM='1'
// END-IF
// IF (RC = 2) THEN
// EXEC PGM=MyProg,PARM='2'
// END-IF
// IF (RC = 3) THEN
// EXEC PGM=MyProg,PARM='3'
// END-IF
// IF (RC > 3) THEN
// EXEC PGM=MyProg,PARM='99'
// END-IF
or
// EXEC PGM=MyProg,PARM='1',cond=(0,ne)
// EXEC PGM=MyProg,PARM='2',cond=(1,ne)
// EXEC PGM=MyProg,PARM='3',cond=(2,ne)
// EXEC PGM=MyProg,PARM='99',cond=(4,lt)
update the previous programs and write to file rather than issueing a return code.
You could run rexx script background and call the programs from rexx. In rexx you can call a program and save the return code then pass it to a subsequent program. This should be viewed as a last resort though
Upvotes: 4