TAL Reference Manual
Expressions
TAL Reference Manual—526371-001
4-2
Data Types of Expressions
Data Types of Expressions
The result of an expression can be any data type except STRING or UNSIGNED. The
compiler determines the data type of the result from the data type of the operands in
the expression. All operands in an expression must have the same data type, with the
following exceptions:
•
An INT expression can include STRING, INT, and UNSIGNED(1–16) operands.
The system treats STRING and UNSIGNED(1–16) operands as if they were 16-bit
values. That is, the system:
°
Puts a STRING operand in the right byte of a word and sets the left byte to 0.
°
Puts an UNSIGNED(1–16) operand in the right bits of a word and sets the
unused left bits to 0, with no sign extension. For example, for an
UNSIGNED(2) operand, the system fills the 14 leftmost bits of the word with
zeros.
•
An INT(32) expression can include INT(32) and UNSIGNED(17–31) operands. The
system treats UNSIGNED(17–31) operands as if they were 32-bit values. The
system places an UNSIGNED(17–31) operand in the right bits of a doubleword
and sets the unused left bits to 0, with no sign extension. For example, for an
UNSIGNED(29) operand, the system fills the three leftmost bits of the doubleword
with zeros.
In all other cases, if the data types do not match, use type transfer functions to make
them match. (For more information on Type transfer functions, see Section 14,
Standard Functions.)
Expression Description Examples
Arithmetic
expression
An expression that computes a
single numeric value and that
consists of operands and arithmetic
operators.
398 + num / 84
10 LOR 12
Constant expression An arithmetic expression that
contains only constants, LITERALs,
and DEFINEs as operands.
398 + 46 / 84
Conditional
expression
An expression that establishes the
relationship between values and
that results in a true or false value. It
consists of relational or Boolean
conditions and conditional
operators.
Relational: a < c
Boolean: a OR b