Getting Started with TRANSACT (32247-90007)
Chapter 8 125
Special Topics
Arrays
Arrays
It is possible to set up multi-dimensional arrays in Transact. We will look at examples of
one- and two-dimensional arrays. The bubble sort example illustrated in Figure 6-20 can
be implemented replacing the dynamic part-number data structure with a static list or
one-dimensional array of part numbers. The resulting program might look like this:
Figure 8-8. One Dimensional Array
1 system ex66,base=orders;
2 define(item) temp-part x(8):
2.1 part-table 20 x(8):
2.2 each-part x(8)=part-table:
3 from-part x(8)=part-table:
4 to-part x(8)=part-table(9);
5 define(item) count i(4),init=0:
6 dun x(4),init="no":
7 yes x(4),init="yes":
8 no x(4),init="no";
9 define(item) parts-this-pass i(4):
10 no-of-parts i(4);
11 <<deleted>>
12 list temp-part:
12.1 part-number:
12.2 part-table:
13 parts-this-pass:
14 no-of-parts;
15 list count:
16 dun:
17 yes:
18 no;
19 <<deleted>>
20 repeat
21 do
22 <<deleted>>
23 get(serial) parts,list=(part-number),status;
24 if status = 0 then
24.1 do
25 let (count) = (count) + 1;
25.1 move (each-part((count))) = (part-number);
25.2 doend
26 else let (dun) = (yes);
27 doend