Getting Started with TRANSACT (32247-90007)

Chapter 6 103
Data Structures
Figure 6-14. Use of ALIAS= for Items with Same Name
The above program is able to create a unique identifier for each type of quantity by using
the ALIAS= option. Within the program, the item is always referenced by the first name in
the DEFINE. The ALIAS item name identifies the item name and dataset as they are
known to IMAGE.
Another way to solve this problem is to use the dynamic feature of Transact’s data
structures. The data known to a Transact program can be redefined or remapped at any
1 system ex54,base=orders;
2 define(item) inv-quantity i(6),alias=(quantity(inventory))
3 order-quantity i(6),alias=(quantity(orderline))
4 tot-inv i(6),head="inventory";
5 list part-number:
6 inv-quantity:
7 order-quantity:
8 tot-inv;
9 find(serial) orderline,list=(part-number,order-quantity)
10 ,perform=100-get-inv;
11 end;
12
13 100-get-inv:
14
15 set(key) list (part-number);
16 let (tot-inv) = 0;
17 find(chain) inventory,list=(inv-quantity)
18 ,perform=110-accum-inv;
19 display(table) part-number:
20 tot-inv:
21 order-quantity;
22 return;
23
24 110-accum-inv:
25
26 let (tot-inv) = (tot-inv) + (inv-quantity);
27 return;