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

42 lines
812 B
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

``++OCCURS DEPENDING ON++`` clauses are complicated to use correctly and do not provide any benefits with regard to memory consumption. It is best to avoid them.
== Noncompliant Code Example
[source,cobol]
----
01  MYTABLEACCOUNT PIC S9(4) BINARY.
01  MYTABLE.
05  MYITEM OCCURS 1 to 1000 DEPENDING ON MYTABLEACCOUNT.
   10  MYFIELD1 PIC X(8).
    10  MYFIELD2 PIC S9(4) BINARY.
----
== Compliant Solution
[source,cobol]
----
01  MYTABLE.
05  MYITEM OCCURS 1000.
   10  MYFIELD1 X(8).
    10  MYFIELD2 PIC S9(4) BINARY.
----
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[]