Syntax
INITIALIZE variable [ initialization_value ]
Parameters
variable
The variable to initialize. This must be a scalar variable.
A scalar variable is a variable type within Boolean, Date, National String, Number, String, and Group types.
initialization_value
The initialization value, as listed in Initialization Values below.
If this parameter is not specified, all string-primitive variables are set to spaces and all number-primitive variables are set to zeros.
Description
The Initialize logic command specifies a uniform initialization value for a variable across all host platforms.
The Initialize logic command is necessary due to unpredictable behavior when assigning string values to group variables with number-primitive variable members that would otherwise occur due to differences in character set usage (EBCDIC or ASCII) across host platforms.
For MCP-based systems, you can move spaces to a numeric variable, in which case the numeric attribute is interpreted as containing zero.
Note: Although the Initialize logic command initializes the values of attributes with initial values, it strongly recommended that the values of these variables are not changed in your logic. If the values are changed they are not restored to their initial value.
For the Initialize logic command:
National string-primitive characters are considered string-primitive characters.
National string-primitive variables initialized to spaces will contain national string-primitive spaces, and national string-primitive variables initialized to zeros will contain national string-primitive zeros.
Date values are considered numeric values.
Initialization values
The following table lists available initialization values.
Initialization Value | Description |
---|---|
Glb.Zeros | Sets all variables to zeros. |
Glb.High | Sets string-primitives to the highest string value, and number-primitives to all 9s. |
Glb.Low | Sets all string-primitives to the lowest string value, all number-primitives to zero. |
Glb.Max | Sets numeric-primitives to all 9s. |
Glb.Min | Sets all unsigned number-primitives to zero, and all signed number-primitives to negative all 9s. |
Note: Initializing string attributes with GLB.LOW and GLB.MIN puts the value 0x01 into the attribute. This value is the lowest legal value in a String attribute.
Example
This example uses a SD_MyGroup group variable, containing SD_Num1, SD_Num2, and SD_Alpha member variables. When the Initialize logic command is invoked, it sets the number-primitive member variables (SD_Num1 and SD_Num2) to zero, and the string-primitive member variable (SD_Alpha) to spaces.
Initialize SD_MyGroup