Getting Started with TRANSACT (32247-90007)

82 Chapter5
Automatic Error Handling and Prototyping
Figure 5-1. Basic Prototype Program for Adding Data
This program would not be considered a good working version, since it will only add one
order. It must be restarted to add another order. However, the program does allow us to
demonstrate or prototype for our user the data flow for adding an order to the database.
The program first displays and inputs data using the vorderhead form (line 4), then adds
this data to dataset orderhead (lines 5 to 7).
It will then repeatedly (line 8) use form vorderdetail to display, input (line 9), and add data
to dataset orderline (lines 10 to 13) each time we press [[ENTER]]. A new vorderdetail
form is put onto the screen for each line of the order. Each form is appended to the
preceding form. An example of entering an order with three lines follows:
Figure 5-2. Running the Basic Prototype Program
_______________________________________________________________________________
1 system ex36,base=orders,vpls=formfile;
2 list(auto) vorderhead;
3 list(auto) vorderline;
4 get(form) vorderhead,init,freeze;
5 put orderhead,list=(order-no,
6 cust-no,
7 order-status,
7.01 order-date);
8 level;
9 get(form) vorderline,init,append;
10 put orderline,list=(order-no,
11 line-no,
12 part-number,
13 quantity);
vorderhead order data
order number [123 ] customer [1 ] status [0 ] date [850101]
line number [1 ] part-number [p001 ] quantity [12 ]
line number [2 ] part-number [p002 ] quantity [12
line number [3 ] part-number [p003 ] quantity [20 ]
line number [ ] part-number [ ] quantity [ ]