COND parameter
The older way of telling a job step whether to run, based on the return codes of earlier steps.
Also written COND, conditional execution
COND controls whether a step runs, by testing the return codes of steps that came before it. It is the traditional mechanism for conditional batch, and it is famous for reading backwards.
The reason is that COND states the condition for skipping a step, not for running it. Written as a comparison and a value, it means "if this test is true, bypass this step". So a test that reads as though it requires a code of four actually skips the step when four is reached. Almost everyone gets this wrong the first several times.
Because of that, modern JCL more often uses IF, THEN and ELSE statements, which express the same logic in the direction you would expect and are considerably easier to read.
You still need to recognise COND, because it appears throughout existing JCL that has been running for decades and will not be rewritten. Reading it correctly is largely a matter of remembering the inversion: the condition describes when the step does not run.
Related terms
- Return codeA number a program leaves behind saying how it went. Zero for clean, higher numbers for warnings and failures.
- Job stepOne program execution within a job. A job is simply a sequence of steps that run in order.
- JCLJob Control Language: the language used to tell the mainframe what programs to run, in what order, and with what files.
- EXEC statementThe JCL statement that starts a step by naming the program or procedure to run.