Getting Started with TRANSACT (32247-90007)

Chapter 8 141
Special Topics
Subprograms
Figure 8-20. The Called Subprogram with DATA=
1 system ex71a,base=orders;
2 define(item) order-table 10 x(50):
3 ot-yr-indx x(50) = order-table:
4 ot-year 9(2)=ot-yr-indx:
5 ot-mo-indx 12 9(4)=ot-yr-indx(3):
6 ot-mo 9(4)=ot-mo-indx;
7 define(item) date x(6):
8 date-yy 9(2)=date:
9 date-mm 9(2)=date(3):
10 indx i(4):
11 end-of-table i(4);
12 define(item) dun i(4):
13 no i(4),init=0:
14 yes i(4),init=1;
15 list date:
16 quantity:
17 order-table:
18 end-of-table:
19 indx:
20 dun:
21 no:
22 yes;
23 let (indx) = 0;
24 let (dun) = (no);
25 while (dun) = (no)
26 do
27 let (indx) = (indx) + 1;
28 if (ot-year((indx))) = (date-yy)
29 then let (dun) = (yes)
30 else
31 if (indx) = (end-of-table)
32 then
33 do
34 let (end-of-table) = (end-of-table) + 1;
35 let (ot-year((indx))) = (date-yy);
36 let (dun) = (yes);
37 doend;
38 doend;
39 let offset(ot-mo) = [(date-mm) - 1] * 4;
40 let (ot-mo((indx))) = (ot-mo((indx))) + (quantity);
41 exit;