![github-actions[bot]](/assets/img/avatar_default.png)
--------- Co-authored-by: sallaigy <sallaigy@users.noreply.github.com> Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
64 lines
1.4 KiB
Plaintext
64 lines
1.4 KiB
Plaintext
== Why is this an issue?
|
|
|
|
In JCL, the `COND` code is used to control the execution of job steps based on the completion codes of previous steps.
|
|
Omitting the `COND` code in a subsequent step will lead to the execution of the step even when previous steps have failed.
|
|
This can result in unnecessary resource usage, potential data corruption, and can make debugging more difficult.
|
|
|
|
=== Exceptions
|
|
|
|
The rule will not trigger on job steps inside `IF/THEN/ELSE/ENDIF` statements.
|
|
|
|
== How to fix it
|
|
|
|
Code a `COND` parameter on this step and all subsequent steps.
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
With the rule parameter `steps` set to 2:
|
|
|
|
[source,jcl,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
//MYJOB JOB ,MSGLEVEL=1
|
|
//STEP1 EXEC PGM=FIRSTPGM
|
|
//STEP2 EXEC PGM=SECONDPGM
|
|
//STEP3 EXEC PGM=THIRDPGM
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,jcl,diff-id=1,diff-type=compliant]
|
|
----
|
|
//MYJOB JOB ,MSGLEVEL=1
|
|
//STEP1 EXEC PGM=FIRSTPGM
|
|
//STEP2 EXEC PGM=SECONDPGM
|
|
//STEP3 EXEC PGM=THIRDPGM,COND=(4,LT)
|
|
----
|
|
|
|
== Resources
|
|
|
|
=== Documentation
|
|
* https://www.ibm.com/docs/en/zos/3.1.0?topic=statement-cond-parameter[z/OS MVS JCL Reference - EXEC statement - COND parameter]
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Parameters
|
|
|
|
.steps
|
|
****
|
|
----
|
|
^4$
|
|
----
|
|
|
|
Maximum number of steps without COND.
|
|
****
|
|
|
|
'''
|
|
|
|
endif::env-github,rspecator-view[] |