Skip to content

Commit

Permalink
Create rule S6946: Incompatible parameters should not be used (#3747)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored May 15, 2024
1 parent b4ce142 commit 14fd3e1
Showing 3 changed files with 79 additions and 0 deletions.
23 changes: 23 additions & 0 deletions rules/S6946/jcl/metadata.json
Original file line number Diff line number Diff line change
@@ -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 changes: 54 additions & 0 deletions rules/S6946/jcl/rule.adoc
Original file line number Diff line number Diff line change
@@ -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[]
2 changes: 2 additions & 0 deletions rules/S6946/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}

0 comments on commit 14fd3e1

Please sign in to comment.