pTAL Guidelines for TAL Programmers

Coding Guidelines
pTAL Guidelines for TAL Programmers527256-002
2-6
DO_PTAL Directive
You cannot specify the PTAL toggle in a SETTOG, RESETTOG, or DEFINETOG
directive.
DO_PTAL Directive
Guideline: Use the DO_PTAL directive to enable additional TAL features.
If you specify the DO_PTAL directive, D40 and later TAL compilers recognize
additional constructs that are required to fully support the pTAL language. For more
information, see DO_PTAL Directive on page 3-5.
Variables
Referencing Variables and Parameters on page 2-6
Equivalenced Variables and Memory on page 2-8
Referencing Variables and Parameters
Guideline: Access the contents of variables and parameters only by explicitly naming
the variables or parameters.
Do not access separately declared variables or parameters by indexing one variable or
parameter to reference another.
In TAL, you can declare several variables or parameters and set them to zero as in
Example 2-2 on page 2-6.
Example 2-1. PTAL Conditional Compilation Toggle
?IFNOT PTAL
DEFINE an_int = INT#;
?ENDIF PTAL
?IF PTAL
DEFINE an_int = INT(32)#;
?ENDIF PTAL
Example 2-2. Setting Variables and Parameters to Zero (TAL Only)
PROC p (a, b, c, d, e);
INT a, b;
INT(64) c;
INT d, e;
BEGIN
INT i;
INT(32) j;
INT k, l, m;
a ':=' 0 & a FOR 7 WORDS; ! Zero all parameters
i ':=' 0 & i FOR 5 WORDS; ! Zero all local variables
END;