Getting Started with TRANSACT (32247-90007)
Chapter 2 53
Using Character Mode I/O
Command Mode
Command Mode
Much of the control of a program can be removed altogether from the program logic and
put into the hands of the user via built-in commands. The following program illustrates a
way to build the functions of adding, updating, and reporting customer data into a
program.
Figure 2-19. Program Using Command Mode for Add, Update, and Display
1 system ex18,base=orders;
2
3 $$help:
4 display "List of customer transactions:";
5 set(command) command;
6
7 $$add:
8 set(delimiter) "/";
9 prompt cust-no,checknot=customer;
10 prompt name:
11 street-addr:
12 city-state:
13 zipcode;
14 put customer;
15
16 $$update:
17 set(delimiter) "/";
18 list(auto) customer;
19 data cust-no,check=customer;
20 get(current) customer;
21 display;
22 data(set) name:
23 street-addr:
24 city-state:
25 zipcode;
26 update customer;
27
28 $$display:
29 list(auto) customer;
30 data cust-no;
31 set(key) list (cust-no);
32 output customer;