Create rule S6935: Do not use implicit SYSIN DD * statements (#3685)
This commit is contained in:
parent
907441949f
commit
c1df97b5cd
25
rules/S6935/jcl/metadata.json
Normal file
25
rules/S6935/jcl/metadata.json
Normal 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
59
rules/S6935/jcl/rule.adoc
Normal 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]
|
2
rules/S6935/metadata.json
Normal file
2
rules/S6935/metadata.json
Normal file
@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user