The DECLARE command is used to define variables within an Apply Engine script. There are two types of variables, Global and Local. Global variables defined in the Field Specification Section are placed into a ‘variable pool’ where they are initialized with the user specified value.
Syntax
DECLARE <variable_name> <length> ‘initial_value’;
Keyword and Parameter Descriptions
Keyword | Description |
---|---|
<variable_name> |
The name of the variable to be defined to the variable pool. |
<length> |
Specifies the length of the variable. Note: All variables are stored internally as Character data types. When specifying the length of a numeric variable you must consider the source, e.g. A source field defined as PIC S9(7) Comp-3 that consumes 4 bytes in the source datastore would be stored as an 8 digit number in a variable.
|
<initial_value> |
Specifies the initial value in single quotes (') to be assigned to the variable. |
Example
Define variables V_Variable1 and V_Variable2 in the variable pool. Set the length of V_Variable1 to 20 and initialized to spaces. V_Variable2 should have a length of 5 and an initial value of zero (0).
DECLARE V_Variable1 20 ‘ ‘;
DECLARE V_Variable2 5 ‘0’;