Getting Started with TRANSACT (32247-90007)
104 Chapter6
Data Structures
time during program execution. Unlike COBOL and Pascal, Transact does not map
physical data storage at compile time. Storage is allocated at run time as the program
processes LIST verbs.
There are also verbs to deallocate storage when it is no longer needed or when it needs to
be remapped. These verbs are illustrated in the program below which solves the same
problem as the program shown in Figure 6-14.
Figure 6-15. Use of SET(STACK) LIST
1 system ex55,base=orders;
4 define(item) tot-inv i(6),head="inventory";
5 list part-number:
6 quantity:
8 tot-inv;
9 find(serial) orderline,list=(part-number,quantity)
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 (tot-inv);
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;