rspec/rules/S3389/rpg/rule.adoc

50 lines
1.0 KiB
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
The use of ``++options( *nopass )++`` on a parameter makes it optional, so it should always be checked before use.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
DCL-PR VIOLATION1 EXTPGM;
LASTNAME Char(10);
FIRSTNAME Char(10) OPTIONS(*NOPASS:*OMIT);
END-PR;
DCL-PI VIOLATION1;
LASTNAME Char(10);
FIRSTNAME Char(10) OPTIONS(*NOPASS:*OMIT);
END-PI;
dsply FIRSTNAME;
dsply LASTNAME; // Noncompliant; LASTNAME is optional
*inlr = *on;
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
DCL-PR VIOLATION1 EXTPGM;
LASTNAME Char(10);
FIRSTNAME Char(10) OPTIONS(*NOPASS:*OMIT);
END-PR;
DCL-PI VIOLATION1;
LASTNAME Char(10);
FIRSTNAME Char(10) OPTIONS(*NOPASS:*OMIT);
END-PI;
dsply FIRSTNAME;
IF %PARMS > 1;
dsply LASTNAME;
EndIf;
*inlr = *on;
----
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::rspecator-view[]