Getting Started with TRANSACT (32247-90007)
Chapter 8 129
Special Topics
Arrays
Line 2 defines an array consisting of 10 occurrences of 10 bytes each. Each occurrence is
made up of a 2-byte line number and an 8-byte part number (lines 3 and 4).
Notice again that the IMAGE access verbs cannot reference array items. Thus lines 16-17
retrieve the next values of line-no and part-number, then lines 30-31 move these values
into the next array occurrence, and line 32 increments the array occurrence subscript.
Lines 20-25 are a loop that subscripts through the array and prints out the contents of
line-no (ot-line) and part-number (ot-part).
Transact allows subscripting of only one dimension of an array. Consequently, if an array
has more than one dimension, other methods must be used to qualify the array access of
all but the outermost dimension. This qualification is made possible by the LET OFFSET
verb.
The next example is a two-dimensional array and illustrates using a subscript to qualify
the outermost dimension and using LET OFFSET to qualify the inner dimension.
Figure 8-11. Two-Dimensional Array
1 system ex68,base=orders;
2 define(item) order-table 10 x(50):
3 ot-yr-indx x(50) = order-table:
4 ot-year 9(2)=ot-yr-indx:
5 ot-mo-indx 12 9(4)=ot-yr-indx(3):
6 ot-mo 9(4)=ot-mo-indx;
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=1;
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: