Almost in all interviews this question asked. The basic usage of COND parameter is to control execution of job steps.
- Some rules for JCL COND parameter
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.
- 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.
How to bypass execution of first Job Step
- Only with COND parameter we cannot bypass first step.
- With IF/ELSE/ THEN /ENDIF statements in first step, whatever be the condition, the first step skips execution
Rules you always need to remember
- -COND test satisfies at step level then that step will not execute
- -COND test satisfies at Job level then the jobs will not execute
- Best example for IF/ELSE/THEN/ENDIF for job step in JCL
- How to give COND parameter both at Job level and Step level