Enform Plus Reference Manual

Enform Plus Language Elements
Enform Plus Reference Manual422684-001
3-11
Aggregates
The subordinate elements of a database table can themselves contain a database table
resulting in nested database tables. For example, consider the following record
description:
02 tot-sales OCCURS 12 times.
10 month PIC X(3).
10 top-dept PIC 999.
10 wkly-sales PIC 99999 OCCURS 4 TIMES.
Enform Plus allows you to reference nested database tables. For example:
Aggregates
An aggregate is the result of a cumulative operation performed for each value that
contributes to the aggregate. An aggregate yields a single value for the group of values
over which it is processed. Aggregates can be specified only as a target-item or in a
request-qualification. Aggregates specified as a target-item are called target aggregates.
Aggregates specified in a request-qualification are called qualification aggregates.
Enform Plus provides two types of aggregates: predefined and user-defined.
The syntax used for an aggregate is as follows:
tot-sales Refers to month, top-dept, and the first
through last elements of wkly-sales
within the first element of tot-sales.
tot-sales[4].wkly-sales[2] Refers to the second element of wkly-
sales within the fourth element of tot-
sales.
tot-sales[1:5].wkly-sales[3] Refers to the third element of wkly-sales
within the first through fifth elements of
tot-sales.
tot-sales[2:3].wkly-sales[1:4] Refers to the first through fourth elements of
wkly-sales within the second through
third elements of tot-sales.
{ { AVG } }
{ { COUNT } }
{ { MAX } ( { field-name } [ OVER ALL ] }
{ { MIN } ( { expression } [ OVER over-item ] }
{ { SUM } }
{ { user-aggregate } [ WHERE logical-expression ] ) , }
{ }
{ { AVG } }
{ { COUNT } }
{ { MAX } ( [ UNIQUE ] field-name [ OVER ALL ] }
{ { MIN } }
{ { SUM } [ WHERE logical-expression ] ) , }
{ { user-aggregate } }