H-Series Application Migration Guide (H06.03+)

pTAL Migration Tasks
H-Series Application Migration Guide429855-006
7-7
Conditional Compilation Changes
Conditional Compilation Changes
Programs that perform conditional compilation by testing for TARGET directives in the
source code might require changes to ensure correct results on the TNS/E platform.
For example, the following code sequence is commonly used to conditionally compile
TNS/R and TNS source code:
?IF RISC1
-- Source code intended for TNS/R
?ENDIF RISC1
?IFNOT RISC1
-- Source code intended for TNS
-- Unintentionally also compiled for TNS/E
?ENDIF
However, when this sequence is used in a TNS/E compilation, the statement ?IFNOT
RISC1 also evaluates to true, and the subsequent source code will be unintentionally
included in the compilation. To distinguish between TNS and TNS/E compilations,
sequences such the preceding should be replaced. In particular, programs should
avoid using the “IFNOT” test for conditional compilation. The preceding sequence
could be changed to:
?IF RISC1
-- Source code intended for TNS/R
?ENDIF RISC1
?IF TNS_ARCH
-- Source code intended for TNS
?ENDIF TNS_ARCH
?IF _TNS_E_TARGET
-- Source code intended for TNS/E
?ENDIF _TNS_E_TARGET
New TNS/E pTAL Feature
TNS/E pTAL provides the following new feature.
16-Byte-Aligned Data
Certain H-series functions require data to be aligned on 16-byte boundaries. TNS/E
pTAL requires such data to be declared in a structure template that provides this 16-bit
alignment. For this purpose, the TNS/E pTAL compiler provides a new attribute,
STRUCTALIGN (MAXALIGN), that causes data to be aligned on the maximum
alignment defined for the platform, which is 16 bytes for the TNS/E platform. For
example:
STRUCT A(*) STRUCTALIGN(MAXALIGN) FIELDALIGN(SHARED8);
BEGIN
INT(16) II; --Located at byte-offset 0 as defined by
--SHARED8
FILLER 2;
INT(32) JJ; --Located at byte-offset 3 as defined by