diff --git a/rules/S6939/jcl/metadata.json b/rules/S6939/jcl/metadata.json new file mode 100644 index 0000000000..71675156dd --- /dev/null +++ b/rules/S6939/jcl/metadata.json @@ -0,0 +1,23 @@ +{ + "title": "DD DATA statements should be delimited", + "type": "CODE_SMELL", + "status": "ready", + "remediation": { + "func": "Constant\/Issue", + "constantCost": "1min" + }, + "tags": [ + ], + "defaultSeverity": "Major", + "ruleSpecification": "RSPEC-6939", + "sqKey": "S6939", + "scope": "All", + "defaultQualityProfiles": ["Sonar way"], + "quickfix": "unknown", + "code": { + "impacts": { + "MAINTAINABILITY": "MEDIUM" + }, + "attribute": "CLEAR" + } +} diff --git a/rules/S6939/jcl/rule.adoc b/rules/S6939/jcl/rule.adoc new file mode 100644 index 0000000000..11574b09bf --- /dev/null +++ b/rules/S6939/jcl/rule.adoc @@ -0,0 +1,40 @@ +== Why is this an issue? + +The `DD DATA` statement continues reading in-stream data until it reaches the end delimiter (`/*` or the delimiter specified by the `DLM` parameter) or until it hits the end-of-file. This can lead to other JCL statements being mistakenly included in the data stream. + +== How to fix it + +Always code a delimiter for `DD DATA` statements, either by using the default delimiter `/*` or coding a custom delimiter using the `DLM` parameter. + +=== Code examples + +==== Noncompliant code example + +[source,jcl,diff-id=1,diff-type=noncompliant] +---- +//STEP1 EXEC PGM=DOTHING +//SYSIN DD DATA +//ALPHA JOB ,MSGLEVEL=(1,1) +//NOPE EXEC PGM=IEFBR14 +//STEP2 EXEC PGM=IEFBR14 +//* End of file +---- + +==== Compliant solution + +[source,jcl,diff-id=1,diff-type=compliant] +---- +//STEP1 EXEC PGM=DOTHING +//SYSIN DD DATA,DLM='><' +//ALPHA JOB ,MSGLEVEL=(1,1) +//NOPE EXEC PGM=IEFBR14 +>< +//STEP2 EXEC PGM=IEFBR14 +//* End of file +---- + +== Resources + +=== Documentation + +* https://www.ibm.com/docs/en/zos/3.1.0?topic=statement-data-parameter[IBM z/OS MVS JCL Reference - DD DATA parameter] diff --git a/rules/S6939/metadata.json b/rules/S6939/metadata.json new file mode 100644 index 0000000000..2c63c08510 --- /dev/null +++ b/rules/S6939/metadata.json @@ -0,0 +1,2 @@ +{ +}