rspec/rules/S1630/rpg/rule.adoc

64 lines
1.5 KiB
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
If a file is defined without the ``++USROPN++`` statement then the natural RPG logic will deal with opening and closing it. However, files defined with ``++USROPN++``, must be both explicitly ``++OPEN++``ed and ``++CLOSE++``d.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
FEWPCCR1 O E PRINTER USROPN
F INFDS(WSFD01)
F INFSR(*PSSR)
C OPEN EWPCCR1
C CLOSE *ALL
----
----
FEWPCCR1 O E PRINTER USROPN
F INFDS(WSFD01)
F INFSR(*PSSR)
/free
open EWPCCR1;
close *ALL;
/end-free
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
FEWPCCR1 O E PRINTER USROPN
F INFDS(WSFD01)
F INFSR(*PSSR)
C OPEN EWPCCR1
C CLOSE EWPCCR1
----
----
FEWPCCR1 O E PRINTER USROPN
F INFDS(WSFD01)
F INFSR(*PSSR)
/free
open EWPCCR1;
close EWPCCR1;
/end-free
----
2021-04-28 16:49:39 +02:00
== See
* http://cwe.mitre.org/data/definitions/459.html[MITRE, CWE-459] - Incomplete Cleanup
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::rspecator-view[]