Page 1 of 1

Flush all steps of a JCL based on return code from one step

PostPosted: Thu Apr 25, 2013 3:09 pm
by ashokkumar_rn
Hi,

I have a JCL with 40 steps.

My requirement is if the return code from STEP-14 is 04, then I have to execute the last step of the job and exit.
This is a cyclic job that runs once every 15 mins.

04 is an acceptable return code for this job.

Can you please help me know how this can be done?

Regards,
Ashok

Re: Flush all steps of a JCL based on return code from one s

PostPosted: Thu Apr 25, 2013 3:19 pm
by Akatsukami
The title of this thread seems incompatible with the opening post. If the completion code of STEP14 is not four, what should be done? (This may be more than one thing.)

Re: Flush all steps of a JCL based on return code from one s

PostPosted: Thu Apr 25, 2013 3:22 pm
by ashokkumar_rn
If the return code from step14 is not four then all the steps should execute.

If its equal to 4 then execute only the last step of the job.

Re: Flush all steps of a JCL based on return code from one s

PostPosted: Thu Apr 25, 2013 3:30 pm
by enrico-sorichetti
why not look at the manuals Yourself
JCL guide,
JCL reference

and meditate on the use of the COND <keyword>
and on the use of the IF/THEN/ELSE construct

???

Re: Flush all steps of a JCL based on return code from one s

PostPosted: Thu Apr 25, 2013 3:30 pm
by Akatsukami
ashokkumar_rn wrote:If the return code from step14 is not four then all the steps should execute.

If its equal to 4 then execute only the last step of the job.

Then you'll want something like this:
//STEP01   EXEC PGM=P1
    :
//STEP14   EXEC PGM=P14
//IF1      IF   (STEP14.RC ¬= 4) THEN
//STEP15   EXEC PGM=P15
    :
//STEP39   EXEC PGM=P39
//ENDIF1   ENDIF
//STEP40   EXEC PGM=P40

Re: Flush all steps of a JCL based on return code from one s

PostPosted: Fri Apr 26, 2013 12:41 pm
by ashokkumar_rn
Thanks to both of you for the help. This is working as expected.