Getting Started with TRANSACT (32247-90007)

Chapter 2 51
Using Character Mode I/O
Looping Structures
Figure 2-17. Program Using WHILE to Loop
It is easier programmatically to use the LEVEL verb. However, when we do so, we ask the
user to do a bit more in order to stop things. The user must enter the character ] to get the
loop to stop.
In order to use the simpler LEVEL structure and still keep things easy for the user, we
could put an extra test in our LEVEL program to accomplish the same thing as we did
using REPEAT or WHILE. The program now looks like this.
1 system ex17,base=orders(";");
2 list(auto) customer;
3 data cust-no ("enter cust-no to delete");
4 while (cust-no) <> 0
5 do
6 set(key) list (cust-no);
7 get customer;
8 display;
9 input "delete this customer?";
10 if input = "Y","YES"
11 then delete(current) customer
12 else display "customer not deleted";
13 data cust-no ("enter cust-no to delete");
14 doend;