Introduction to ENFORM

Building the Target File
How ENFORM Works
058051 Tandem Computers Incorporated 3–5
Building the
Target File
The target file, which is produced by the query processor, is the result of your query—
before the data is formatted and generated as a report. In its final form, you can think
about it as a collection of records that:
Are built by taking data out of the different files and putting it together in one file.
Are sorted in the order that they will ultimately appear in the report.
Contain all of the specified fields from the database; again, the fields are in the
order that they will appear in the report.
Contain derived data items that are the results of arithmetic expressions clauses,
and aggregate clauses; in this respect the target file can be viewed as a construct
that allows calculations to be done over a group.
Figure 3-2 conceptually illustrates how the target file would be produced for the
following type of query:
OPEN parts, fromsup;
LINK parts TO fromsup VIA partnum;
parts.partnum
inventory
price,
(price*inventory),
SUM (price*inventory OVER suppnum,)
SUM (price*inventory OVER ALL),
AVG ((price*inventory) OVER suppnum),
WHERE inventory GREATER THAN 0;
The target file records in Figure 3-2:
Are sorted by supplier number—as a result of the BY clause.
Contain fields for the suppnum, parts, price, and inventory items specified in the
query.
Contain a derived field (the product of price and inventory).
Contain fields that are the result of doing calculations such as AVG for the groups
of records in the target file.
Do not contain target records for any records in the data files where the inventory
field is less than or equal to 0.