LENGTH OF Expression

The LENGTH OF construct works differently in ACUCOBOL-GT than in IBMCOBOL when the data item used is a table. ACUCOBOL-GT returns the size of the entire table, while IBM returns the size of a single element of the table. For example, consider the following:

01  my-data.
    03  my-table occurs 20 times.
        05  my-element-1   pic x(10).
        05  my-element-2   pic 99.
MOVE LENGTH OF my-element-1 TO data-size.
MOVE LENGTH OF my-table TO data-size.
MOVE LENGTH OF my-table(1) TO data-size.

ACUCOBOL-GT and IBM COBOL both treat the first MOVE as MOVE 10 TO data-size, and the third MOVE as MOVE 12 TO data-size. However, is treated differently. ACUCOBOL-GT treats the second MOVE as MOVE 240 TO data-size, while IBM COBOL treats the second MOVE as MOVE 12 TO data-size.

When using IBM compatibility mode, the ACUCOBOL-GT compiler treats LENGTH OF in the same way as IBM COBOL.