Getting Started with TRANSACT (32247-90007)

Chapter 8 139
Special Topics
Subprograms
Figure 8-18. The Called Subprogram
1 system ex70a,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):
14 yes i(4);
15 list dun:
16 no:
17 yes;
18 list order-table:
19 end-of-table:
20 indx:
21 date:
22 order-no:
23 order-date:
24 quantity;
25 let (indx) = 0;
26 let (dun) = (no);
27 while (dun) = (no)
28 do
29 let (indx) = (indx) + 1;
30 if (ot-year((indx))) = (date-yy)
31 then let (dun) = (yes)
32 else
33 if (indx) = (end-of-table)
34 then
35 do
36 let (end-of-table) = (end-of-table) + 1;
37 let (ot-year((indx))) = (date-yy);
38 let (dun) = (yes);
39 doend;
40 doend;
41 let offset(ot-mo) = [(date-mm) - 1] * 4;
42 let (ot-mo((indx))) = (ot-mo((indx))) + (quantity);
43 exit;