Getting Started with TRANSACT (32247-90007)

176 Chapter9
Creating Custom Applications
Transactions Across Multiple Datasets
Transactions Across Multiple Datasets
All of the above concepts are still valid even if the transaction affects multiple datasets.
The following program illustrates a way to write generic code that accesses more than one
dataset. This code could be expanded to include the topics previously discussed to provide
form independence, user exits, etc.
Figure 9-32. One Screen, Multiple Dataset Generic Transaction
The generic transaction adds a new record to the parts dataset, which is the master
dataset. It then adds a record to each of two detail sets, inventory and partvendors.
Part-number is a critical element and is common to all three sets.
The dictionary description of the lists used by the program are as follows:
1 system addprt,base=orders
2 ,vpls=formfile;
3 list(auto) addpart-global;
4 level;
5 list(auto) partvendors;
6 level;
7 list(auto) inventory;
8 level;
9 list(auto) parts;
10 get(form) addpart,init;
11 put parts,list=(@);
12 move (global-part) = (part-number);
13 end(level);
14 move (part-number) = (global-part);
15 put inventory,list=(@);
16 end(level);
17 move (part-number) = (global-part);
18 put partvendors,list=(@);
19 end;