Variables

PL/MX variables associate identifiers with storage. The PL/MX compiler automatically allocates and manages the correct storage for a particular datatype. When the identifier of a variable appears on the left side of an assignment operator, the value of the expression on the right side of the assignment operator is stored in the associated memory location. When the identifier of a variable is used in any other context, its value is fetched from memory and used in place of the identifier.

Syntax

{identifier} {datatype} [initial-value-expression]  

initial-value := initial-value-expression

identifier

Is a valid PL/MX identifier that specifies the name to associate with the data of the type designated by the datatype.

datatype

Specifies a PL/MX datatype as described in Datatypes.

initial-value-expression

Is a valid PL/MX expression for the specified datatype. The initial-value-expression is calculated and assigned to the variable at the point of declaration.

Examples

Declare a positive integer variable which will be initialized to NULL (the default initialization value):

a_variable POSITIVE;
Declare an integer variable with an initial value:
loop_counter INTEGER := 5;