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

49 lines
831 B
Plaintext

The number of distinct data items used in a condition (``++IF++``, ``++EVALUATE++``, ...) should not exceed a defined threshold.
== Noncompliant Code Example
With the default default threshold of 3:
[source,cobol]
----
IF WS-FOO(1) = 1 OR *> 1st data item
WS-FOO(2) = 2 OR
WS-FOO(3) = 3 OR
WS-BAR = 4 OR *> 2nd data item
WS-BAZ = 5 OR *> 3rd data item
WS-QUX = 42 *> Noncompliant; 4th data item
END-IF.
----
== Compliant Solution
[source,cobol]
----
IF WS-FOO(1) = 1 OR
WS-FOO(2) = 2 OR
WS-FOO(3) = 3 OR
WS-BAR = 4 OR
WS-BAZ = 42
END-IF.
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
include::parameters.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]