Create rule S6935: Do not use implicit SYSIN DD * statements (#3685)

This commit is contained in:
github-actions[bot] 2024-03-04 11:38:22 +01:00 committed by GitHub
parent 907441949f
commit c1df97b5cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,25 @@
{
"title": "Do not use implicit SYSIN DD * statements",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"constantCost": "1min"
},
"tags": [
"bad-practice"
],
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-6935",
"sqKey": "S6935",
"scope": "All",
"defaultQualityProfiles": [],
"quickfix": "unknown",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM",
"RELIABILITY": "MEDIUM"
},
"attribute": "COMPLETE"
}
}

59
rules/S6935/jcl/rule.adoc Normal file
View File

@ -0,0 +1,59 @@
Input data that is not a JCL statement implicitly generate a `DD *` statement with the name `SYSIN`.
== Why is this an issue?
This behavior is implicit and may lead to confusion or unexpected behavior.
For example, this code:
[source,jcl]
----
//MYDD DD DSN=TEST
Some in-stream data
// DD DSN=CONCAT-DD
----
Gets implicitly transformed into:
[source,jcl]
----
//MYDD DD DSN=TEST
//SYSIN DD *
Some in-stream data
// DD DSN=CONCAT-DD
----
So the last DD statement is a concatenation of the implicit `//SYSIN DD *` statement instead of the explicit `//MYDD DD` statement.
== How to fix it
Add explicitly the `//SYSIN DD *` before the in-stream data.
=== Code examples
==== Noncompliant code example
[source,jcl,diff-id=1,diff-type=noncompliant]
----
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=A123456.SORTIN,DISP=SHR
//SORTOUT DD DSN=A123456.SORTOUT,DISP=OLD
SORT FIELDS=(1,12,CH,A)
----
==== Compliant solution
[source,jcl,diff-id=1,diff-type=compliant]
----
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=A123456.SORTIN,DISP=SHR
//SORTOUT DD DSN=A123456.SORTOUT,DISP=OLD
//SYSIN DD *
SORT FIELDS=(1,12,CH,A)
/*
----
== Resources
=== Documentation
* https://www.ibm.com/docs/en/zos/3.1.0?topic=parameter-location-in-jcl[IBM reference - DD * location in the JCL]

View File

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