Getting Started with TRANSACT (32247-90007)

52 Chapter2
Using Character Mode I/O
Looping Structures
Figure 2-18. Program Using LEVEL to Loop
18 Programmatically, END(LEVEL) is the same as if the user entered the
special key ]. It terminates the current level of the program.
The preceding three examples allow the user to get out of the loop by just pressing
[[RETURN]] in response to the cust-no prompt. That is, each program continues to loop
until the cust-no input is zero, which is the result of pressing [[RETURN]] in response to
the prompt for cust-no.
1 system ex15a,base=orders(";");
2 set(delimiter) "/";
3 list(auto) customer;
4 level;
5 data cust-no ("enter cust-no to delete");
6 if (cust-no)
0
7 then
8 do
9 set(key) list (cust-no);
10 get customer;
11 display;
12 input "delete this customer?";
13 if input = "Y","YES"
14 then delete(current) customer
15 else display "customer not deleted";
16 doend
17 else
18 end(level);