What is COND in JCL1. COND parameter is JCL can be used to skip a step based on the return code from the previous step or steps of the JCL.
2. This COND parameter can also be used to skip a step based on the return code from a previous step or steps in PROC.
3. You can use the COND parameter to run a job even though, any of the previous steps have Abended (Abend means Abnormal Termination).
4. With the COND parameter, you can also run a step only and only if any of the previous steps have Abended.
Let us understand COND in JCL with lots of examples-
The ‘COND’ parameter defines the conditional processing in JCL and this is an important parameter in JCL.
You can set the COND parameter at –
JOB level – In JOB Statement(JOB card).
STEP level – In EXEC statement.
In most cases, it is a good practice to code the COND parameter at STEP Level but based on your requirement, you can code this at JOB level or STEP level or at both the places.
In this case, the COND parameter at the JOB level is – COND=(0,NE)
COND=(0 NE) will test –
Is return code of 0 not equal to the return code of any of the steps in JCL? If this is true, then terminate this JCL. So, if any of the steps (i.e. STEP01, STEP02 or STEP03) has a return code of Non-Zero, then this condition will be true and the Job will be terminated.
There can be multiple COND Parameter in JCL but a maximum of 8 COND parameter is allowed.
COND parameter can be used at JOB level or STEP level or at both the places.
IF condition in JCL
IF-ELSE-IF and IF is a better way to control the conditional processing of a JCL. In JCL IF condition is better than the COND parameter because of 2 reasons –
And the IF condition in JCL is easy to code as compared to the COND parameter.
Sometimes, JCL programmers with less experience find COND parameter little confusing and boring and it is easier to read and understand IF-ELSE-END-IF condition in JCL.