Relationship of the COND parameters on JOB and EXEC statements
- The JOB statement COND parameter performs the same return code tests for every step in a job. If a JOB statement return code test is satisfied, the job terminates.
- An EXEC statement COND parameter performs
return code tests for only its step in a job. Using EXEC COND
parameters, different tests can be performed for each step. Thus,
EXEC COND parameters are useful if the same return code has different
meanings in different job steps, or if you want to take different
actions according to which job step produced a return code.
The system evaluates a COND parameter on the first EXEC statement in a job as false. However, you can use an IF statement before the first EXEC statement in a job to bypass the step.
- The JOB COND parameter, when EXEC statements
also contain COND parameters, performs the same return code tests
for every step in the job.
- If the JOB statement return code test is satisfied, the job terminates. The job terminates regardless of whether or not any EXEC statements contain COND parameters and whether or not an EXEC return code test would be satisfied.
- If the JOB statement return code test is not satisfied, the system then checks the COND parameter on the EXEC statement for the next step. If the EXEC statement return code test is satisfied, the system bypasses that step and begins processing of the following step, including return code testing.
The COND parameter on both the JOB and EXEC statements is useful to set some conditions for all steps in the job and other conditions for particular steps.
- No COND parameters on JOB or EXEC statements means the system does not perform any return code tests, but tries to execute each step in the job.