From a1a88a27d075b88e649822e98807b74290323b6b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 11:06:53 +0100 Subject: [PATCH] Create rule S6939: DD DATA should be delimited (#3734) * Create rule S6939 * Add rule description * Update rules/S6939/jcl/rule.adoc Co-authored-by: Rudy Regazzoni <110470341+rudy-regazzoni-sonarsource@users.noreply.github.com> --------- Co-authored-by: sallaigy Co-authored-by: Gyula Sallai Co-authored-by: Rudy Regazzoni <110470341+rudy-regazzoni-sonarsource@users.noreply.github.com> --- rules/S6939/jcl/metadata.json | 23 ++++++++++++++++++++ rules/S6939/jcl/rule.adoc | 40 +++++++++++++++++++++++++++++++++++ rules/S6939/metadata.json | 2 ++ 3 files changed, 65 insertions(+) create mode 100644 rules/S6939/jcl/metadata.json create mode 100644 rules/S6939/jcl/rule.adoc create mode 100644 rules/S6939/metadata.json 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 @@ +{ +}