rspec/rules/S2202/rule.adoc
2021-01-27 13:42:22 +01:00

37 lines
1.5 KiB
Plaintext

Specifying the parameters to a procedure with a ``++PLIST++`` makes that procedure unusable from free-format code. Instead, prototypes should be used - both when defining a procedure and when calling it. They have the additional benefit of allowing you to use keywords such as ``++Const++`` to better-specify how parameters are passed to a procedure. Further, the use of a prototype instead of a ``++PLIST++`` is cleaner and more consistent with the code required for subprocedures.
== Noncompliant Code Example
----
* Noncompliant; PLIST specified
C *ENTRY PLIST
C PARM ZipCode 5 0
C PARM City 20
...
* Noncompliant; PLIST used in call
C CALL 'OTHERPROG'
C PARM ZipCode
C PARM City
----
== Compliant Solution
----
D MYPROG PR
D ZipCode 5I Const
D City 20A Const
D MYPROG PI
D ZipCode 5I Const
D City 20A Const
...
D OTHERPROG PR ExtPgm('OtherProgram')
D ZipCode 5I Const
D City 20A Const
/free
OTHERPROG(ZipCode:City);
/end-free
----