Introduction to ENFORM
Listing Information From a File Onto a Report
Using ENFORM to Produce Complete Reports
058051 Tandem Computers Incorporated 4–5
Figure 4-2. Listing of a Single File
SUPPNUM PARTNUM PARTCOST
1 212 92000.00
1 244 87000.00
6 4102 14500.00
1 6201 5800.00
6 4103 24500.00
10 7102 6800.00
1 7301 2400.00
The report in Figure 4-2 is the complete listing of the file named fromsup. There are
seven records in the file, one for each part. Each record has three fields: the supplier
number, the part number, and the cost. The meaning of each field may not be obvious
from the report because the data names for the fields are used as headings. Later, you
will learn how to make reports more understandable.
Figure 4-2 shows a characteristic of ENFORM reports that helps in formatting
complete reports. The fields that contain numeric values are aligned to the right.
Additionally, if the report contained character strings, they would be aligned to the
left. The alignment is not based on the characters in the field but on the definition of
the field in that data dictionary. For example, a character string might contain only
numbers (the digits 0 through 9). Even though the string looks like a number, it will
be aligned to the left.
Listing Parts of a File Listing the entire contents of a single file is not very useful except in a maintenance
situation where you have to check all records in a file. Usually, you want to list certain
fields in a certain order when they meet specific criteria.
The LIST statement can specify the fields within a file rather than whole file. When
you specify field names rather than the file name, only the specified fields are listed.
For example, you can generate a report similar to the one in Figure 4-2, but containing
only the supplier number and the part number of a part. This report is shown in
Figure 4-3. The following ENFORM statements will generate the report:
>OPEN fromsup;
>LIST suppnum, partnum;
Figure 4-3. A Simple Report by Fields
SUPPNUM PARTNUM
1 212
1 244
6 4102
1 6201
6 4103
10 7102
1 7301