Page 1 of 1

Using OR clause in COND

PostPosted: Wed Mar 23, 2011 4:01 pm
by samurai007
Hi,

I need to execute a job which has 4 steps.
The 4th step should execute only if either of the first three steps have executed successfully.
I used the following logic.

//Step1
//Step2
//Step3
//Step4 EXEC PGM=XXX,COND=((0,NE,STEP1),(0,NE,STEP2),(0,NE,STEP3))

However, this is working more like an "AND" clause rather than an "OR" clause on the COND statement.
Is there anyway I can make it check for an "OR" condition on the Return Codes of the preceding 3 steps ?

Thanks,
Sam.

Re: Using OR clause in COND

PostPosted: Wed Mar 23, 2011 5:13 pm
by Robert Sample
From the JCL Language Reference manual, chapter 16.5:
Use the COND parameter to test return codes from previous job steps and determine whether to bypass this job step. You can specify one or more tests on the COND parameter, and you can test return codes from particular job steps or from every job step that has completed processing. If any of the test conditions are satisfied, the system evaluates the COND parameter as true and bypasses the job step. If none of the test conditions specified on the COND parameter are satisfied, the system evaluates the COND parameter as false and executes the job step.
You may be better off using an IF statement in this case.