Getting Started with TRANSACT (32247-90007)
Chapter 2 41
Using Character Mode I/O
Adding Data to a Dataset
Figure 2-6. Program to Check Item Entered by User
4 The CHECKNOT=CUSTOMER causes the cust-no input to be validated
against the customer dataset to verify that an entry does not already exist.
If an entry does exist, Transact provides an error message and prompts for
input of cust-no again.
This results in the following dialog when the program is run and the user enters a
customer number that already exists:
Figure 2-7. User Interaction with Early Error Checking
1 system ex10,base=orders(";");
2 set(delimiter) "/";
3 level;
4 prompt cust-no,checknot=customer;
5 prompt name:
street-addr:
city-state:
zipcode;
6 put customer;
7 end;
CUST-NO> 301 |
| *ERROR: ENTRY ALREADY EXISTS (IMAGE 1,4,CUSTOMER)|
| CUST-NO> 306 |
| NAME> High Fashions |
| STREET-ADDR> 1 The Embarcadero |
| CITY-STATE> San Francisco, Ca. |
| ZIPCODE> 93245 |
| CUST-NO> ] |
| EXIT/RESTART(E/R)?> |
| END OF PROGRAM |
| :