Skip to content

Commit

Permalink
Create rule S6939: DD DATA should be delimited (#3734)
Browse files Browse the repository at this point in the history
* Create rule S6939

* Add rule description

* Update rules/S6939/jcl/rule.adoc

Co-authored-by: Rudy Regazzoni <[email protected]>

---------

Co-authored-by: sallaigy <[email protected]>
Co-authored-by: Gyula Sallai <[email protected]>
Co-authored-by: Rudy Regazzoni <[email protected]>
  • Loading branch information
4 people authored Mar 13, 2024
1 parent a2241c3 commit a1a88a2
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
23 changes: 23 additions & 0 deletions rules/S6939/jcl/metadata.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
40 changes: 40 additions & 0 deletions rules/S6939/jcl/rule.adoc
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 2 additions & 0 deletions rules/S6939/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}

0 comments on commit a1a88a2

Please sign in to comment.