Create rule S6942: Procedures should not contain in-stream data (#3741)

* Create rule S6942

* Add rule description

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
This commit is contained in:
github-actions[bot] 2024-03-11 16:52:56 +01:00 committed by GitHub
parent 47a517fc47
commit cf7dd4781a
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": "Avoid the use of in-stream data in procedures",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"constantCost": "15min"
},
"tags": [
],
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-6942",
"sqKey": "S6942",
"scope": "All",
"defaultQualityProfiles": [],
"quickfix": "unknown",
"code": {
"impacts": {
"MAINTAINABILITY": "LOW"
},
"attribute": "CONVENTIONAL"
}
}

40
rules/S6942/jcl/rule.adoc Normal file
View File

@ -0,0 +1,40 @@
== Why is this an issue?
Earlier versions of z/OS and certain installations do not support in-stream data in procedures.
This can lead to inconsistencies within the codebase and compatibility issues.
== How to fix it
Remove the uses of `DD *` and `DD DATA` from procedures.
You can add in-stream data to a procedure step by using `DD DUMMY` inside the procedure and overriding that by a `DD *` or `DD DATA` statement in the calling step.
=== Code examples
==== Noncompliant code example
[source,jcl,diff-id=1,diff-type=noncompliant]
----
//MYPROC PROC
//STEP1 EXEC PGM=DOTHING
//SYSIN DD *
Input data
/*
// PEND
//* Call procedure
//CALLPRC EXEC PROC=MYPROC
----
==== Compliant solution
[source,jcl,diff-id=1,diff-type=compliant]
----
//MYPROC PROC
//STEP1 EXEC PGM=DOTHING
//SYSIN DD DUMMY
// PEND
//* Call procedure
//CALLPRC EXEC PROC=MYPROC
//STEP1.SYSIN DD *
Input data
/*
----

View File

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