Getting Started with TRANSACT (32247-90007)
Chapter 8 133
Special Topics
Arrays
Figure 8-14. Two-Dimensional Array with LET OFFSET (Continued)
The differences between this example and example EX68 are highlighted.
Line 43.1 specifies the byte offset for a year. At this point, we have resolved addresses for
the child items of ot-yr-indx which are ot-year and ot-mo-indx. Since the length of the data
for each year is 50 bytes (2 byte year and 12 months of 4 bytes each), the offset for the n th
year is (n -1) * 50. However, in the example, indx is used to indicate a year and has been
specified relative to zero. Thus the example does not need to convert n to be relative to
zero.
Line 55 specifies the byte offset for a month relative to its parent item. Since the length of
data for each month is 4 bytes, the offset for the n th month is (n - 1) * 4.
34 find(chain) orderline,list=(quantity)
35 ,perform=200-each-line;
36 return;
37
38 200-each-line:
39 let (indx) = -1;
40 let (dun) = (no);
41 while (dun) = (no)
42 do
43 let (indx) = (indx) + 1;
43.1 let offset(ot-yr-indx) = (indx) * 50;
44 if (ot-year) = (date-yy)
45 then let (dun) = (yes)
46 else
47 if (indx) = (end-of-table)
48 then
49 do
50 let (end-of-table) = (end-of-table) + 1;
51 let (ot-year) = (date-yy);
52 let (dun) = (yes);
53 doend;
54 doend;
55 let offset(ot-mo) = [(date-mm) - 1] * 4;
56 let (ot-mo) = (ot-mo) + (quantity);
57 return;