Skip to content

Commit

Permalink
Create rule S6942: Procedures should not contain in-stream data (#3741)
Browse files Browse the repository at this point in the history
* Create rule S6942

* Add rule description

---------

Co-authored-by: sallaigy <[email protected]>
Co-authored-by: Gyula Sallai <[email protected]>
  • Loading branch information
3 people authored Mar 11, 2024
1 parent 47a517f commit cf7dd47
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
23 changes: 23 additions & 0 deletions rules/S6942/jcl/metadata.json
Original file line number Diff line number Diff line change
@@ -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 changes: 40 additions & 0 deletions rules/S6942/jcl/rule.adoc
Original file line number Diff line number Diff line change
@@ -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
/*
----
2 changes: 2 additions & 0 deletions rules/S6942/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}

0 comments on commit cf7dd47

Please sign in to comment.