rspec/rules/S2033/rpg/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

55 lines
1.3 KiB
Plaintext

== Why is this an issue?
Because library names could change from environment to environment, they should never be hard-coded in a program. Instead, you should use a variable to specify the library name and set that variable with data external to the program.
=== Noncompliant code example
[source,rpg]
----
CLRPFM FILE(XPJLIB/FILE01)
----
=== Compliant solution
[source,rpg]
----
CHGVAR VAR(&LIB01) VALUE(&PREFIX *CAT 'LIB')
CLRPFM FILE(&LIB01/FILE01)
----
=== Exceptions
Hard-coding references to QTEMP, which is a temporary library, is allowed.
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use a variable for the library name and set it with data external to the program.
'''
== Comments And Links
(visible only on this page)
=== on 12 Oct 2014, 16:51:40 Freddy Mallet wrote:
Just a feeling @Ann, but I would decrease the severity to Major and would not activate this rule by default.
=== on 14 Oct 2014, 14:48:34 Ann Campbell wrote:
\[~freddy.mallet] breaking this rule can (will) cause runtime failures, which is why I've made it critical. I set it to on by default because I've had 2 different companies ask me for the rule (and the second actually helped me specify it).
=== on 14 Oct 2014, 21:04:33 Freddy Mallet wrote:
OK
endif::env-github,rspecator-view[]