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 <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
Co-authored-by: Rudy Regazzoni <110470341+rudy-regazzoni-sonarsource@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2024-03-13 11:06:53 +01:00 committed by GitHub
parent a2241c39a3
commit a1a88a27d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 65 additions and 0 deletions

View File

@ -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
rules/S6939/jcl/rule.adoc Normal file
View File

@ -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]

View File

@ -0,0 +1,2 @@
{
}