Getting Started with TRANSACT (32247-90007)
30 Chapter1
Getting Started
Reporting from Multiple Datasets
data elements in the orderhead dataset are to be retrieved (for each
record) that is selected. For each record that is retrieved, control is
transferred to the label get-orderdata as specified by the PERFORM=
option.
8 We use LEVEL to take advantage of some automatic housekeeping
provided by Transact. This statement and the END(LEVEL) statement on
line 16 specify a program area where data elements retrieved from data
sets are temporarily stored. When the level is ended, the storage area for
the elements is released. LEVELs will be discussed more in later sections.
9 Lines 9-11 setup and retrieve the customer record for the customer
number just retrieved from orderhead.
12 SET(KEY) sets up the retrieval key for order details.
13 LIST(AUTO) reserves the space to hold the orderline record.
14 FORMAT sets up the list of data items that we want to report via output.
The name comes from the customer dataset. All other items come from
orderline.
15 OUTPUT(CHAIN) retrieves the order details and prints the data. The
NOCOUNT option suppresses printing the number of records found.
16 END(LEVEL) releases the storage space for customer and orderline
records.
17 RETURN specifies that control is to be returned to the statement that
contains the PERFORM instruction. This is the FIND verb in statement 5.
This program produces the report shown below. Since the OUTPUT verb controls retrieval
of detail information for each order, the report is formatted with headings for each order
number.