Create rule S6946: Incompatible parameters should not be used (#3747)

This commit is contained in:
github-actions[bot] 2024-05-15 10:54:09 +02:00 committed by GitHub
parent b4ce142059
commit 14fd3e16ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,23 @@
{
"title": "Incompatible parameters should not be used",
"type": "BUG",
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"constantCost": "5min"
},
"tags": [
],
"defaultSeverity": "Critical",
"ruleSpecification": "RSPEC-6946",
"sqKey": "S6946",
"scope": "All",
"defaultQualityProfiles": ["Sonar way"],
"quickfix": "unknown",
"code": {
"impacts": {
"RELIABILITY": "HIGH"
},
"attribute": "CONVENTIONAL"
}
}

54
rules/S6946/jcl/rule.adoc Normal file
View File

@ -0,0 +1,54 @@
== Why is this an issue?
In JCL, certain parameters are incompatible with each other. For example, in the `DD` statement, the `DYNAM` parameter should not have any parameters coded after it, or the `DLM` parameter is only meaningful with `DD *` and `DD DATA`. Using incompatible parameters can lead to unexpected behavior or JCL errors. It can also make the code harder to understand and maintain.
== How to fix it
Remove one of the incompatible parameters from the JCL statement. Refer to the issue message and the JCL language reference to find the incompatible parameter pairs.
=== Code examples
In the following example, the `DLM` parameter is only compatible with `DD *` and `DD DATA`.
In addition, `SYSOUT` and `VOLUME` are incompatible parameters and coding both of them on the same `DD` statement will lead to a JCL error.
==== Noncompliant code example
[source,jcl,diff-id=1,diff-type=noncompliant]
----
//STEP1 EXEC PGM=DOTHING
//SYSIN DD DSN=A.B.C,DLM='AA' <-- Noncompliant
//SYSPRINT SYSOUT=*,VOLUME=SER=339006 <-- Noncompliant
----
==== Compliant solution
[source,jcl,diff-id=1,diff-type=compliant]
----
//STEP1 EXEC PGM=DOTHING
//SYSIN DD DSN=A.B.C
//SYSPRINT SYSOUT=*
----
== Resources
=== Documentation
* https://www.ibm.com/docs/en/zos/3.1.0?topic=mvs-zos-jcl-reference[z/OS MVS JCL Reference]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
* Primary: Remove this '%s' parameter; it is incompatible with an earlier parameter '%s'.
* Primary for DLM: Remove this 'DLM' parameter; it is only compatible with in-stream data sets.
* Secondary: Incompatible parameter.
=== Highlighting
The primary location should be the parameter, with a secondary location on the earlier parameter.
endif::env-github,rspecator-view[]

View File

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