In general, the clause ``++INDEXED BY++`` should be used whenever possible when handling COBOL tables. If it's not possible, then avoid using a numeric display variable to access the table's elements. Instead, use a ``++BINARY++``/``++COMP++`` variable, which the processor can handle more efficiently.


== Noncompliant Code Example

----
       01 SUBS PIC 9(5).
       01 INVENTORY-RECORD.
          05 Field-A PIC X OCCURS 10000 TIMES.
       ...
       PERFORM VARYING SUBS FROM 1 BY 1 UNTIL SUBS > 10000
         MOVE ITEM1 TO Field-A (SUBS)      *> Noncompliant
       END-PERFORM.
----


== Compliant Solution

----
       01 SUBS PIC 9(5) COMP.
       01 INVENTORY-RECORD.
          05 Field-A PIC X OCCURS 10000 TIMES.
       ...
       PERFORM VARYING SUBS FROM 1 BY 1 UNTIL SUBS > 10000
         MOVE ITEM1 TO Field-A (SUBS)
       END-PERFORM.
----
or 

----
       01 INVENTORY-RECORD.
          05 Field-A PIC X OCCURS 10000 TIMES INDEXED BY IDX1.
       ...
       PERFORM VARYING IDX1 FROM 1 BY 1 UNTIL IDX1 > 10000
         MOVE ITEM1 TO Field-A (IDX1)
       END-PERFORM.
----


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
