I am trying to get my head around using the COND statement in JCL on both the JOB step and the EXEC step. My aim is as follows:
- All steps must complete with zero return code
- Unless explicitly indicated for a particular step
- The job should stop when a step completes with a return code not expected
Mostly, all steps will complete with zero, so it is the unusual path to have the over-ride. I don't want to have to code COND on each EXEC step to cover the normal zero case.
I had hoped that the following would do this, but I think the priority of COND on the JOB step appears to over-ride COND on an EXEC step.
//MYJOB JOB ,COND=(0,NE)
//JOBLIB DD DSN=...
// DD DSN=...
//STEP1 EXEC PGM=MYPGM1
//STEP2 EXEC PGM=MYPGM2
//STEP3 EXEC PGM=MYPGM3,COND=(8,NE,STEP2)
//STEP4 EXEC PGM=MYPGM4
//
Is there any way to code this without doing the following:
//MYJOB JOB
//JOBLIB DD DSN=...
// DD DSN=...
//STEP1 EXEC PGM=MYPGM1
//STEP2 EXEC PGM=MYPGM2,COND=(0,NE,STEP1)
//STEP3 EXEC PGM=MYPGM3,COND=(8,NE,STEP2)
//STEP4 EXEC PGM=MYPGM4,COND=(0,NE,STEP3)
//