Getting Started with TRANSACT (32247-90007)

38 Chapter2
Using Character Mode I/O
Adding Data to a Dataset
Adding Data to a Dataset
This first program adds new customers to the customer set.
Figure 2-1. Program to Add Data to a Dataset
1 By including the database password (“;”) in the SYSTEM statement, we
avoid prompting the user for it.
2 The LEVEL verb sets up a looping structure which repeats whenever the
END verb is executed (line 5 in the example). Levels can be nested, as we
will see in later examples. What happens when the END verb is executed
is that Transact keeps track of the start of the code identified by each
LEVEL verb. Control returns to the starting point of the current level
whenever the END verb is executed.
3 The PROMPT verb sets up data storage and prompts the user, one data
item at a time, to enter values for a new record. Transact automatically
generates entry text to identify each item as it should be entered. By
default, the prompt is the name of the data item.
4 The PUT statement adds the record just entered to the customer set.
1 system ex8,base=orders(";");
2 level;
3 prompt cust-no:
name:
street-addr:
city-state:
zipcode;
4 put customer;
5 end;