Introduction to ENFORM
Connecting Files
Using ENFORM to Produce Complete Reports
058051 Tandem Computers Incorporated 4–9
Connecting Files To this point, you have learned how to produce simple, qualified, single-file reports.
Single-file reports are useful and a valid use of ENFORM, but they do not take full
advantages of all the capabilities of ENFORM and relational databases. Remember,
one of the primary advantages of a relational database is to allow you to work with
either one file or multiple related files. Multiple files can be connected, logically, to
satisfy your needs for information. This allows you to work with simple files—
connecting them, when you have to, to form more complex views of the database.
There are two ways that you can use ENFORM to connect files: (1) by qualification
through the use of the WHERE clause and (2) by using the LINK statement.
Connecting Files By Using
the WHERE Clause
Assume you have two files in the database named fromsup and supplier.
fromsup records have these fields supplier records have these fields
| |
| |
| |
partnum suppnum
suppnum suppname
partcost address
city
state
By connecting the files, you can produce (for example) a report that contains the
partnum, partcost, and suppnum fields from the fromsup file along with their matching
suppnum field from the supplier file. You do this by taking advantage of the fact that
the field (data item) suppnum appears in both files.
An example of using the WHERE clause to connect the files is entering:
>OPEN fromsup, supplier;
>LIST BY fromsup.suppnum, BY suppname, partnum, partcost,
WHERE fromsup.suppnum = supplier.suppnum;
to generate the report in Figure 4-9.
Figure 4-9. Connecting Files Using WHERE
SUPPNUM SUPPNAME PARTNUM PARTCOST
1 TANDEM COMPUTERS 212 92000.00
244 87000.00
6201 5800.00
7301 2400.00
6 INFORMATION STORAGE 4102 14500.00
4103 24500.00
10 STEELWORK INC 7102 6800.00