rspec/rules/S3939/cobol/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

52 lines
1.2 KiB
Plaintext
Raw Permalink 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.

== Why is this an issue?
``++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)
=== Message
Replace this clause with a simple "OCCURS" clause with no "DEPENDING [ON]".
'''
== Comments And Links
(visible only on this page)
=== on 24 Mar 2017, 17:24:03 Pierre-Yves Nicolas wrote:
On the web:
* "OCCURS DEPENDING ON is best avoided..." (\http://computer-programming-forum.com/48-cobol/58d65724a4bdc95b.htm)
* "The main purpose of ODO is to increase the efficiency of the Binary Search." (ODO=Occurs Depending On) (\http://ibmmainframes.com/about47790.html)
endif::env-github,rspecator-view[]