pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

identifier
is the identifier of the simple variable, specified in the form described in Section 2, Language
Elements.
initialization
is an expression that represents the value to store in identifier. The default number base
is decimal. The kind of expression you can specify depends on the scope of the simple variable:
For a global simple variable, use a constant expression.
For a local or sublocal simple variable, use any arithmetic expression including variables.
You can initialize simple variables of any data type except UNSIGNED. For more information
about initializing a simple variable, see the following subsections.
Specifying Simple Variable Address Types
The address type of a simple variable is the same as the address type of a pointer to data of the
same object data type as the simple variable, as in the following examples:
INT .j; ! A pointer: address type is WADDR
INT i; ! A simple variable: address type is WADDR
Initializing Simple Variables With Numbers
When you initialize with a number, it must match the data type specified for the simple variable.
The data type determines what kind of values the simple variable can store:
STRING, INT, and INT(32) simple variables can contain integer constants in binary, decimal,
hexadecimal, or octal base.
REAL and REAL(64) simple variables can contain signed floating-point numbers.
FIXED simple variables can contain signed 64-bit fixed-point numbers in binary, decimal,
hexadecimal, or octal base. For decimal numbers, you can also specify a fractional part,
preceded by a decimal point. If a FIXED number has a different decimal setting than the
specified fpoint, the system scales the number to match the fpoint. If the number is scaled
down, some precision is lost.
Chapter 3 (page 46) describes the syntax for specifying numeric constants in each number base
by data type.
Initializing Simple Variables With Character Strings
STRING, INT, and UNSIGNED simple variables can be initialized with character strings. The
character string can contain the same number of bytes as the simple variable or fewer. Unspecified
bytes are zero bytes. Each character in a character string requires one byte of storage.
Examples
Example 36 (page 106)
Example 37 (page 106)
Example 38 (page 107)
Example 39 (page 107)
Example 40 (page 107)
Example 41 (page 107)
Specifying Simple Variable Address Types 105