Getting Started with TRANSACT (32247-90007)
Chapter 1 27
Getting Started
Reporting from Multiple Datasets
Reporting from Multiple Datasets
The following program prints the customer’s name rather than the customer’s cust-no.
This requires data to be retrieved from both the customer set and the orderhead set.
Figure 1-15. Program to Report from Two Datasets
2 LIST(AUTO) reserves space to hold records from the customer set.
3 LIST(AUTO) reserves space to hold records from the orderhead set.
4 DATA asks the user to input the value of the cust-no to be retrieved.
5 SET(KEY) specifies that cust-no is a key element. For Image, this
establishes the value to be used for direct retrieval from a master dataset
and chained retrieval from a detail dataset.
6 GET CUSTOMER gets the customer record. The LIST=(@) option specifies
that we retrieve the entire record. This is equivalent to specifying
list=(cust-no,name,street-addr,city-state,zipcode);
7 The default option for the OUTPUT verb is to print all data items that we
have listed. To limit our printing, we must use the FORMAT verb first to
indicate which data items we want to print.
8 Since the program is accessing data from more than one dataset, we must
specify the subset of data that is to be retrieved by OUTPUT. The
LIST=(@) limits data retrieval to the elements in the orderhead dataset.
1 system ex5,base=orders;
2 list(auto) customer;
3 list(auto) orderhead;
4 data cust-no;
5 set(key) list (cust-no);
6 get customer,list=(@);
7 format name:
order-no:
order-status;
8 output(chain) orderhead,list=(@);