Using OR clause in COND

JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Using OR clause in COND

Postby samurai007 » Wed Mar 23, 2011 4:01 pm


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.

//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 ?

Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Using OR clause in COND


Re: Using OR clause in COND

Postby Robert Sample » Wed Mar 23, 2011 5:13 pm

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.
Robert Sample
Global moderator
Posts: 3094
Joined: Sat Dec 19, 2009 8:32 pm
Location: Bellevue, Iowa
Has thanked: 1 time
Been thanked: 176 times

Return to JCL


  • Related topics
    Last post