TAL Reference Manual

Compiler Directives
TAL Reference Manual526371-001
16-27
Usage Considerations
Usage Considerations
DECS can appear anywhere in the source code outside the global declarations. It
cannot appear in the compilation command.
If you manipulate data stack contents without the compiler’s knowledge (with CODE
statements, for example), you should use DECS to calibrate the compiler’s internal S-
register counter.
If the compiler decrements (or increments) the S register below (or above) its initial
value in a procedure or subprocedure, the compiler issues a warning of S-register
underflow (or overflow). If the source program is correct, use DECS to calibrate the
compiler’s S-register counter, particularly in subprocedures because sublocal variables
have S-relative addresses.
Modularize any use of the DECS directive and CODE statement as much as possible;
they are not portable to future software platforms.
Example of DECS Directive
The following example shows the following actions:
1. A CODE (PUSH ...) statement (not a CALL statement) places the parameters for
PROC_NAME onto the data stack.
2. A CODE (PCAL ...) statement calls PROC_NAME.
3. PROC_NAME decrements the data stack by three words without the compiler’s
knowledge.
A DECS directive calibrates the compiler’s internal S-register setting; DECS
decrements the register setting by three words.
SUBPROC sp;
BEGIN
!Lots of code
STACK param1, param2, param3; !Load parameters onto
! register stack
CODE (PUSH %722); !Push parameters onto
! data stack
CODE (PCAL proc_name); !Call the procedure
?DECS 3 !Decrement compiler’s
!More code ! S-register counter by
END; ! three words
DEFEXPAND Directive
DEFEXPAND lists expanded DEFINEs and SQL-TAL code in the compiler listing.
The default is NODEFEXPAND.