pTAL Conversion Guide

Statements
pTAL Conversion Guide527302-002
15-3
Data Types Must Match
If your program tests the value of the condition code after an assignment
statement, it must follow guidelines that differ from those of TAL.
Topics:
Data Types Must Match on page 15-3
Address Types Must Match on page 15-5
Changing Implicit Pointers on page 15-7
Data Types Must Match
pTAL data type compatibility rules for assignment statements are more restrictive than
those of TAL. This section discusses compatibility of pTAL data types, except for
address types, which are discussed in a separate topic, later in this section.
Topics:
TAL on page 15-3
pTAL on page 15-4
TAL
The value on the right side of an assignment statement can be assigned to the location
on the left side if, after evaluating both sides, the value and the storage location
contain the same number of bits—16 bits, 32 bits, or 64 bits. You must ensure that the
address stored in a pointer has the correct semantics to address the target data. (In
assignment statements, TAL treats one-byte STRING values and 1-bit to 16-bit
UNSIGNED values as INT values; and UNSIGNED 17-bit to 31-bit values as INT(32)
values.)
Although TAL does not report a syntax error for assignments in the preceding
examples that are indicated as “OK,” some of the assignments are not meaningful
because TAL moves the bits from the source to the destination without converting the
number to the format required by the destination’s data type.
Example 15-1. Valid and Invalid Assignments (TAL) (page 1 of 2)
INT i;
INT(32) j;
REAL r;
REAL(64) t;
STRING s;
UNSIGNED(16) u1;
UNSIGNED(31) u2;
FIXED f;