pTAL Conversion Guide

Data Representation
pTAL Conversion Guide527302-002
4-4
Constant Lists
Rules for the FIELDALIGN clause:
You must use the FIELDALIGN clause if SHARED2 and SHARED8 do not produce
the same alignment. The FIELDALIGN directive has no effect on constant lists.
If you specify SHARED8 and the constants are not well aligned, the native
compilers report an error. You might need to rearrange the entries in your constant
list or specify one or more zero entries as filler items.
Use the FIELDALIGN clause only at the outermost level of a constant list. Nested
constant lists inherit the field alignment of the outermost level of the constant list.
Do not specify a FIELDALIGN clause on a constant list whose elements are
treated as bytes.
Example 4-1. pTAL Constant Lists
Invalid:
[1,2D,3] ! SHARED2 and SHARED8 produce
! different alignments
FIELDALIGN(SHARED8) [1,2D,3] ! Not well-aligned for
! SHARED8 access
FIELDALIGN(SHARED8) [1,0,2F,3] ! Not well-aligned for
! SHARED8 access
FIELDALIGN(SHARED8) [3, FIELDALIGN(SHARED8) 1,2];
! Embedded FIELDALIGN clause
STRING i[0:3] := FIELDALIGN(SHARED8) [0, 1, 2, 3];
! Elements are treated as bytes
Valid:
[1,2,3,4]
[1,0,2D,3] ! Same alignment for TNS and native processes
! because of 16-bit zero element
FIELDALIGN(SHARED2) [1,2D,3]
FIELDALIGN(SHARED8) [1,0,2D,3]
FIELDALIGN(SHARED8) [1,0D,0,2F,3]