Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

The iterative expression syntax for a complex array is the following:

1-dimensional array:

arrayitem(#startnum[/endnum1[/increment1]] 1st subscript range

2-dimensional array:

arrayitem(#startnum[/endnum1[/increment1]], 1st subscript range #startnum[/endnum2[/increment2]] 2nd subscript range

3-dimensional array:

arrayitem(#startnum1[/endnum1[/increment1]], 1st subscript range #startnum2[/endnum2[/increment2]], 2nd subscript range #startnum3[/endnum3[/increment3]]) 3rd subscript range

The following rules apply:

- Parentheses indicate an array.
- Use up to three # symbols to indicate three dimensions of an array.
- Separate the subscript ranges with commas.
- All of the symbols used for generating suffixed data items, above, apply to each array range.
- Each dimension is described by a separate Data Division entry with an OCCURS clause.

The following SOURCE statements reference a 2 by 3 array:

SOURCE ARRAY-ITEM (1, 1) SOURCE ARRAY-ITEM (1, 2) SOURCE ARRAY-ITEM (1, 3) SOURCE ARRAY-ITEM (2, 1) SOURCE ARRAY-ITEM (2, 2) SOURCE ARRAY-ITEM (2, 3)

Can, instead, be coded as:

SOURCE ARRAY-ITEM (#2, #3)

The following iterative expression:

SOURCE ARRAY-ITEM (#3, #2)

Replaces the following code:

SOURCE ARRAY-ITEM (1, 1) SOURCE ARRAY-ITEM (1, 2) SOURCE ARRAY-ITEM (2, 1) SOURCE ARRAY-ITEM (2, 2) SOURCE ARRAY-ITEM (3, 1) SOURCE ARRAY-ITEM (3, 2)

The following statement produces SUM statements for each element of a three dimensional array of 3 by 2 by 3:

SUM TABLE ELEMENT (#3, #2, #3)

The following iterative expressions are examples of ranges within a one dimensional array:

SUM EXT-SALES-DOLLARS (#1/3) PIC Z,ZZ9 SUM QTR-1-SALES-DOLLARS PIC ZZ,ZZ9 SUM EXT-SALES-DOLLARS (#4/6) PIC Z,ZZ9 SUM QTR-2-SALES-DOLLARS PIC ZZ,ZZ9 SUM EXT-SALES-DOLLARS (#7/9) PIC Z,ZZ9 SUM QTR-3-SALES-DOLLARS PIC ZZ,ZZ9 SUM EXT-SALES-DOLLARS (#10/12) PIC Z,ZZ9 SUM QTR-4-SALES-DOLLARS PIC ZZ,ZZ9 SUM YR-SALES-DOLLARS PIC $$$$,$$$