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
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
01 MYTABLE.
05 MYITEM OCCURS 1000.
10 MYFIELD1 X(8).
10 MYFIELD2 PIC S9(4) BINARY.