Enform Plus Reference Manual
Statements
Enform Plus Reference Manual—422684-001
4-10
Declaring a User Aggregate
heading-string
is a string literal that is the default heading for the declared element. Remember
string literals must be enclosed in quotation marks (“ ”).
Specify the DECLARE statement before you reference a user variable, user aggregate, or
user table. Enform Plus stores information about each user-defined element in the
internal table. This information remains in the internal table until you issue a subsequent
CLOSE statement for the user-defined element, issue a DICTIONARY statement or a
?DICTIONARY command, or end the Enform Plus session.
Declaring a User Aggregate
User aggregates are processed just like the predefined aggregates. The step-
expression of a user aggregate can contain:
•
Arithmetic expressions
•
IF/THEN/ELSE expressions
The optional end-expression is the final operation to be performed after all of the
qualifying records are processed by the step-expression. The end-
expression can contain any of the following:
•
Predefined aggregates
•
Arithmetic expressions
•
IF/THEN/ELSE expressions
By default, the starting-value for a user aggregate is zero unless the user
aggregate is defined with alphanumeric internal format. In this case, the default value is
blanks. An initial value is supplied when you specify initialize-constant. If
you omit end-expression but specify initialize-constant, precede initialize-
constant with two commas.
The following example uses the DECLARE statement to define a user aggregate:
DECLARE project (x) = (IF x < 2000 THEN project + x + .05 * x
ELSE project + x + .04 * x);
More information about user aggregates can be found under Aggregates on page 3-11.
Declaring a User Variable or User Table
A user variable or table declaration remains in effect until the end of the current Enform
Plus session unless you override the user variable or table by declaring a new variable or
table with the same name.
By default, both user variables and elements in user tables are stored as 64-bit signed
integers. To change this default, specify the optional INTERNAL clause described under
INTERNAL Clause
on page 5-42. In the following example, the user variable