rspec/rules/S1725/cobol/rule.adoc
jtingsanchali 96d9ddb930
RULEAPI-755 Update CWE URLs by removing .html suffix and update with https protocol (#926)
* Change affects only see.adoc and rule.adoc files, not comments-and-links.adoc files
2022-04-07 08:53:59 -05:00

41 lines
862 B
Plaintext

Even though closing an open file isn't always mandatory (for instance when stopping the execution of a COBOL program with the ``++STOP RUN++`` statement), it's good coding practice to always explicitly close any open files. This rule checks that for every ``++OPEN++`` statement there is a corresponding ``++CLOSE++`` statement somewhere in the program.
== Noncompliant Code Example
[source,cobol]
----
OPEN INPUT my-file
----
== Compliant Solution
[source,cobol]
----
OPEN INPUT my-file
...
CLOSE my-file
----
== See
* https://cwe.mitre.org/data/definitions/459[MITRE, CWE-459] - Incomplete Cleanup
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]