Introduction to ENFORM
Statements, Clauses, and Commands
Using ENFORM—The Basics
058051 Tandem Computers Incorporated 2–11
Item Formatting Clauses
These clauses can be used to specify display formats and column headings for items
that appear in the report. One item formatting clause is HEADING which prints a
column heading of your choice for each column of data items in the report. The
default for the heading is the item name specified in the dictionary (through DDL). If
you enter
LIST partnum HEADING “PART/NUMBER”;
the heading at the top of the part number column will be PART
NUMBER
on two lines (the / means start a new line).
New Items Clauses
One of the things that you can do with ENFORM is to use new item clauses to
temporarily create new data from existing data and to produce the data on a report;
for example, to print the sum of two fields, in the database, under the column heading
SUM. Typical new item clauses are SUBTOTAL, TOTAL, arithmetic expression
clauses such as * (multiply), and aggregate clauses such as AVG.
The TOTAL clause allows you to specify that the total for any column of numeric data
items should be produced on the report. And the SUBTOTAL clause produces the
subtotal for any group of numeric data items. Both TOTAL and SUBTOTAL are
included as part of the LIST statement.
Arithmetic expression clauses can be combinations of data items and numeric literals
that can be added, subtracted, or multiplied to produce new values.
Aggregate clauses specify that one value should be computed (by ENFORM) for a set
of items; for example, the average price of all parts supplied by a particular supplier.
An example of using SUBTOTAL, TOTAL, * and AVG is entering:
OPEN parts, fromsup;
LINK parts to fromsup VIA partnum;
LIST BY suppnum,
parts.partnum
inventory
price,
(price*inventory) HEADING “TOTAL COST”,
SUBTOTAL OVER suppnum,
TOTAL,
AVG ((price*inventory) OVER suppnum);
to produce a report like the one illustrated in Figure 2-9.