Getting Started with TRANSACT (32247-90007)
134 Chapter8
Special Topics
Arrays
Notice that once the proper offsets for an item have been established, the item can be
referenced directly without any further qualification (lines 44, 51, and 56).
The above example is not the only way a two-dimensional array can be implemented. It is
perhaps as close as it is possible to get to the way COBOL or Pascal might define the same
array, recognizing that Transact always requires you to specify byte offsets rather than an
occurrence number.
The following example illustrates an alternative way to implement the same array. It is
not any better than the first and in fact, the first is probably easier to follow. However, it is
presented with the hope of improving your understanding of the ways you can manipulate
data storage.
Figure 8-15. Two-Dimensional Array, Special Use of LET OFFSET
1 system ex69,base=orders;
2 define(item) order-table x(500):
3 <<deleted>>
4 ot-year 9(2)=order-table:
5 <<deleted>>
6 ot-mo 9(4)=order-table;
7 define(item) date x(6):
8 date-yy 9(2)=date:
9 date-mm 9(2)=date(3):
10 indx i(4):
11 end-of-table i(4),init=0;
12 define(item) dun i(4):
13 no i(4),init=0:
14 yes i(4),init=1;
15 list dun:
16 no:
17 yes;
18 list order-table,init:
19 end-of-table:
20 indx:
21 date:
22 order-no:
23 order-date:
24 quantity;