rspec/rules/S4883/cobol/rule.adoc

43 lines
927 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
This rule is a more precise version of S1308 preventing the use of ``++GO TO++``. The flow of a program is already complicated to understand with simple ``++GO TO++``s. It's even worse when a ``++GO TO++`` is executed conditionally like this is the case with ``++GO TO DEPENDING ON++``.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
PROCEDURE DIVISION.
...
GO TO PARAGRAPH-10
PARAGRAPH-20
PARAGRAPH-30
DEPENDING ON WS-PARA-NUMBER *> Noncompliant
...
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
PROCEDURE DIVISION.
...
EVALUATE WS-PARA-NUMBER
WHEN 1
PERFORM PARAGRAPH-10
WHEN 2
PERFORM PARAGRAPH-20
WHEN 3
PERFORM PARAGRAPH-30
WHEN OTHER
PERFORM PARAGRAPH-99
END-EVALUATE
...
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]