Getting Started with TRANSACT (32247-90007)

Chapter 3 65
Using VPLUS and IMAGE
Updating Data in a Dataset
Figure 3-9. Using REPEAT with VPLUS to Update Data
6 The IF statement instructs Transact to quit if a customer number is not
input. If one is input, then the DO/DOEND block of statements retrieve
the information, display it on the screen, accept the changed data, and
update the dataset.
As was indicated earlier, another way to get the cust-no is to introduce a separate form to
ask for it first. Let's assume that we have set up this second form in the dictionary and in
the formsfile. The dictionary listing for this form and the format of the form are shown
below.
Figure 3-10. Dictionary Definition of Customer Number Form
1 system ex26,base=orders,vpls=formfile;
2 list(auto) customer;
3 repeat
4do
5 get(form) vcustomer,init;
6 if (cust-no) <> 0
7 then
8do
9 set(key) list (cust-no);
10 get customer;
11 put(form) vcustomer;
12 get(form) vcustomer;
13 update customer;
14 doend;
15 doend
16 until (cust-no) = 0;
show file
FILE vcustno
FILE TYPE: RESPONSIBILITY:
VCUSTNO FORM
ELEMENT(ALIAS): PROPERTIES: ELEMENT(PRIMARY):
CUST-NO 9 (4,0,4) CUST-NO