User guide

Specifying Computations for a Report
Developing an ENFORM Query
058058 Tandem Computers Incorporated 3–37
When the OVER syntax is specified, ENFORM calculates grouped percentage values
by performing the following:
1. ENFORM adds together the grouped values of the element modified by the PCT
clause to obtain a total grouped value. (Remember an element is grouped when a
preceding element in the query is modified by a BY or BY DESC clause.) In the
preceding example, the first grouped quantity values are: 1, 2, 2, and 2 resulting in
a total grouped value of 7. ENFORM calculates the total grouped value of each
group in the report.
2. ENFORM then divides the individual values for each group by the total grouped
value to obtain the group percentage values. In the preceding example, the first
quantity value of the first grouped value is 1. ENFORM divides 1 by the total
grouped value 7 (obtained in the first step) resulting in a grouped percentage
value of 14.29.
Combine the SUBTOTAL and TOTAL clauses with the PCT clause to obtain the
subtotal and total of the percentage values. The PCT values do not total exactly one
hundred per cent since precision is lost due to truncation during division. In the
following example, the SUBTOTAL and TOTAL clauses are used with the PCT clause
to modify quantity:
OPEN odetail;
LIST BY ordernum,
partnum,
quantity,
quantity PCT AS F5.2,
SUBTOTAL OVER ordernum,
TOTAL,
WHERE ordernum LT 30;