Tables
Indexed tables
Statement: Accessing data items in indexed tables
Options: OPT(2)
Conditions: In all cases
V6 behavior: An efficient sequence is used to access indexed table elements by caching the offset to the start of the table in a globally available register versus having to reload this each time
Source Example:
1 TAB.
5 TABENTS OCCURS 40 TIMES INDEXED BY TABIDX.
10 TABENT1 PIC X(4) VALUE SPACES.
10 TABENT2 PIC X(4) VALUE SPACES.
IF TABENT1 (TABIDX) NOT = TABENT2 (TABIDX)
statements
END-IF
Performance: V6 is 17% faster than V4