Getting Started with TRANSACT (32247-90007)
64 Chapter3
Using VPLUS and IMAGE
Updating Data in a Dataset
Updating Data in a Dataset
Now that we have added data to the customer dataset, how do we go about updating this
data? This section shows two approaches. The only difference between the two is the way
in which we ask for input of the cust-no.
The first example uses the form vcustomer for both input of the cust-no and input of the
data. The second example sets up a separate form vcustno for entering the customer
number. It then uses form vcustomer for data entry.
Figure 3-8. Using LEVEL with VPLUS to Update Data
4 First, GET(FORM) gets the cust-no for the record that we want to update.
5 SET establishes the key or IMAGE path into the customer dataset to
retrieve the record to be updated.
6 GET retrieves the record from the customer dataset.
7 PUT(FORM) displays the information that currently exists for the
customer on the screen. At this point the operator changes the field(s) that
need to be updated.
8 GET(FORM) accepts the data from the screen.
9 UPDATE puts the record in the dataset customer.
As in previous examples, we can exit the LEVEL repeating loop at any time merely by
pressing [[ F8 ]].
This same program could be coded using the REPEAT construct as follows:
1 system ex25,base=orders,vpls=formfile;
2 level;
3 list(auto) customer;
4 get(form) vcustomer,init;
5 set(key) list (cust-no);
6 get customer;
7 put(form) vcustomer;
8 get(form) vcustomer;
9 update customer;