pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

Retrieving Global Data Declarations
After a SAVEGLOBALS compilation completes successfully, you can specify the following directives
in a USEGLOBALS compilation to retrieve the global data declarations and initializations:
Effect in Same USEGLOBALS CompilationDirective in USEGLOBALS Compilation
USEGLOBALS
Retrieves global data declarations
Suppresses compilation of text lines and SOURCE directives (but not
other directives) until BEGINCOMPILATION appears
Begins compilation of text lines and SOURCE directivesBEGINCOMPILATION
CAUTION: Be sure the global data declarations in both the SAVEGLOBALS and USEGLOBALS
compilations are identical. If you include new or changed global data declarations anywhere in
the USEGLOBALS source file, results are unpredictable.
The USEGLOBALS compilation terminates if the global declarations file:
Cannot be found or opened by the compiler
Was created using a different version of the compiler
Examples
The source file in Example 333 (page 374) (MYPROG) is compiled in examples Example 334
(page 375) through Example 337 (page 375), which show how the SAVEGLOBALS, USEGLOBALS,
BEGINCOMPILATION, and SYNTAX directives interact.
Example 333 MYPROG Source File for Example 334 Through Example 337
Source File MYPROG
! Source file MYPROG
! Unless USEGLOBALS is active, compile the entire source file.
?SOURCE SHARGLOB
?BEGINCOMPILATION ! When USEGLOBALS is active, compile
! following code
?PUSHLIST, NOLIST, SOURCE $system.system.extdecs
?POPLIST
PROC my_first_proc;
BEGIN
...
END;
PROC my_last_proc;
BEGIN
...
END;
File of Shared Global Data, SHARGLOB
?SOURCE glbfile1 (section1, section2)
?SOURCE moreglbs
INT ignore_me1;
INT ignore_me2;
The compilation command in Example 334 (page 375) compiles myprog (the source file in
Example 333) and saves global data declarations and data initializations.
374 Compiler Directives