User guide

Formatting a Report
Developing an ENFORM Query
058058 Tandem Computers Incorporated 3–39
The following query generates a running total for quantity within the by-item
ordernum:
OPEN odetail;
LIST BY ordernum,
partnum,
quantity,
quantity CUM OVER ordernum AS I7,
WHERE ordernum LE 25;
Report:
ORDERNUM
Part
Number QUANTITY
CUM
QUANTITY
21
25
244
2001
2403
4103
244
5103
6301
6402
1
2
2
2
1
1
2
10
1
3
5
7
1
2
4
14
Running total begins anew
at each new order.
Formatting a Report If you specify a LIST statement in your query, ENFORM selects information from your
data base, formats the information, and directs the information to the spooler, a
physical file, or your terminal screen. If you write a query that consists of only an
OPEN statement, a DECLARE statement, and a LIST statement with nothing but field
names, arithmetic expressions, IF/THEN/ELSE expressions, user variables, user
tables, user aggregates, or predefined aggregates (no by-items, no clauses, no options
set), ENFORM writes the selected information according to the following defaults:
Target List Elements
ENFORM prints the first target list element specified in the LIST statement in the
leftmost report column, the second in the next column, and so on. If all the needed
columns do not fit on a line, ENFORM folds the line including the heading.
Data order
ENFORM determines the order in which data values are printed within a column
by the order in which the data values are read from the data base. ENFORM does
not sort the data values.
Column width
ENFORM determines the width of a column by whichever is larger: the length of
an element in characters (as described in the data dictionary or the DECLARE
statement) or the length of the element’s heading in characters.
Horizontal spacing
ENFORM skips two spaces between columns.