Getting Started with TRANSACT (32247-90007)

140 Chapter8
Special Topics
Subprograms
In this example, the main program and subprogram share the same data. The two
programs do not have to define the data storage identically, but both must be aware that
they are working with the same space. In our example, both programs do define the data
storage the same way.
The example can be modified so that the two programs only share the data that both need.
Figure 8-19. Calling a Subprogram Using DATA=
1 system ex71,base=orders;
2 define(item) order-table 10 x(50);
3 define(item) end-of-table i(4),init=1;
4 list order-no:
5 order-date:
6 quantity:
7 order-table,init:
8 end-of-table;
9 find(serial) orderhead,list=(order-no,order-date),
10 perform=100-each-order;
11 display order-table;
12 exit;
13
14 100-each-order:
15
16 set(key) list (order-no);
17 find(chain) orderline,list=(quantity)
18 ,perform=200-each-line;
19 return;
20
21 200-each-line:
22 call ex71a,data=order-date;
23 return;