Getting Started with TRANSACT (32247-90007)
106 Chapter6
Data Structures
In the last example we can take advantage of both usages of marker items as follows:
Figure 6-19. Use of Marker Items
1 system ex59,base=orders;
4 define(item) tot-inv i(6),head="inventory";
4.1 define(item) begin-orderline @:
4.2 end-orderline @;
4.3 list tot-inv;
5 list begin-orderline:
5.1 part-number:
6 quantity:
7 end-orderline;
9 find(serial) orderline,list=(begin-orderline:end-orderline)
10 ,perform=100-get-inv;
11 end;
12
13 100-get-inv:
14
14.1 list quantity;
15 set(key) list (part-number);
16 let (tot-inv) = 0;
17 find(chain) inventory,list=(quantity)
18 ,perform=110-accum-inv;
18.1 set(stack) list (end-orderline);
19 display(table) part-number:
20 tot-inv:
21 quantity,head="order-quantity";
22 return;
23
24 110-accum-inv:
25
26 let (tot-inv) = (tot-inv) + (quantity);
27 return;