User Aggregates - Tandem ENFORM 058057 Reference Manual

Data management library
Table of Contents

Advertisement

When the predefined aggregates do not meet your needs, you can define your own

User Aggregates

aggregates with a DECLARE statement. A user-defined aggregate can be used
anywhere a predefined aggregate can appear with two exceptions:
A user aggregate cannot be referenced in the end expression of the declaration of
another user aggregate.
A user aggregate declared with an end expression cannot be used as a
qualification aggregate OVER a by-item.
The syntax of a user-defined aggregate is shown in Section 5 with the DECLARE
statement. The syntax is also shown here to clarify this discussion.
user-aggregate-name ( formal-argument ) = ( step-expression
[ , [ end-expression ] [ , initialize-constant ] ] )
user-aggregate-name
is a unique name you give your aggregate. The name must follow the naming
rules described earlier in this section. This name is also used to obtain the current
value of the aggregate in step-expression and end-expression.
formal-argument
is a unique name used to represent the actual field name or expression in the
aggregate definition.
step-expression
is an arithmetic expression to be computed for each value contributing to the
aggregate. Normally step-expression includes a reference to the user-aggregate-name
so that a value is accumulated over the contributing values.
end-expression
is an arithmetic expression to be computed after all qualifying values for the
aggregate are processed. End-expression can contain a pre-defined aggregate name.
If end-expression is omitted and initialize-constant is present, an extra comma must
precede initialize-constant.
initialize-constant
is a numeric literal that is the starting value of the aggregate. Zero is the default.
When end-expression is omitted and initialize-constant is present, an extra comma
must precede initialize-constant.
Parentheses must appear exactly as shown in this syntax.
Consider the following user aggregate:
DECLARE grossavg (x) = (grossavg + 1.10 * x, grossavg/COUNT
058057 Tandem Computers Incorporated
(x));
ENFORM Language Elements
Aggregates
3–15

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enform

Table of Contents