rspec/rules/S1137/cobol/rule.adoc
2022-02-04 16:28:24 +00:00

38 lines
1018 B
Plaintext

``++GO TO++`` should not be used to transfer control outside the current module, because any implied ``++EXIT++`` points will then be ignored. A module is either a section, a paragraph, or a set of paragraphs called with the ``++PERFORM ... THRU ...++`` statement.
== Noncompliant Code Example
[source,cobol]
----
PERFORM PARAGRAPH1 THRU PARAGRAPH3. > code contained between PARAGRAPH1 and PARAGRAPH3 is now considered as a module
EXIT PROGRAM.
PARAGRAPH1.
MOVE A TO B.
IF SOMETHING
GO TO PARAGRAPH3 >OK
END-IF.
IF SOMETHING-ELSE
GO TO PARAGRAPH4 >NOK as we leave the module called with "PERFORM PARGRAPH1 THRU PARAGRAPH3" statement
END-IF.
PARAGRAPH2.
MOVE A TO B.
PARAGRAPH3.
EXIT.
PARAGRAPH4.
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
endif::env-github,rspecator-view[]