pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
Example 334 Saving Global Data Declarations and Data Initializations
pTAL /IN myprog/ myobj; SAVEGLOBALS ptalsym
A USEGLOBALS compilation (Example 335 (page 375)) then produces object file newobj and
retrieves global data declarations and initialization from ptalsym and global initializations from
myobj. When USEGLOBALS is active, the compiler ignores text lines and SOURCE directives until
BEGINCOMPILATION appears in the source file.
Example 335 Retrieving Global Data Declarations and Data Initializations
pTAL /IN myprog/ newobj; USEGLOBALS ptalsymj
You can check the syntax of global data declarations before saving them, as in Example 336
(page 375).
Example 336 Checking the Syntax of Global Data Declarations
pTAL /IN myprog/; SAVEGLOBALS ptalsym, SYNTAX
After you correct any errors, you can recompile myprog as in Example 337 (page 375).
Example 337 Recompiling MYPROG After Correcting Errors
pTAL /IN myprog/; USEGLOBALS ptalsym
Migrating from TNS/R to TNS/E
The EpTAL compiler does not accept the SAVEGLOBALS and USEGLOBALS directives.
To migrate a pTAL program that uses SAVEGLOBALS and USEGLOBALS from TNS/R to TNS/E:
1. Remove SAVEGLOBALS from the SAVEGLOBALS compilation command line.
2. Compile the file from FIX_THIS_LINK using the EpTAL compiler, omitting SAVEGLOBALS from
the compilation command.
3. Remove USEGLOBALS from each USEGLOBALS compilation command line.
You can leave BEGINCOMPILATION in this file. The EpTAL compiler ignores
BEGINCOMPILATION, and you need BEGINCOMPILATION if you want to compile the same
files using the pTAL compiler.
4. Compile each file from FIX_THIS_LINK using the EpTAL compiler, omitting USEGLOBALS from
each compilation command.
If all files compile without errors, the migration is done. (To compile the same files using the pTAL
compiler, specify SAVEGLOBALS in the SAVEGLOBALS compilation command and USEGLOBALS
in each USEGLOBALS compilation command.)
If some files do not compile successfully because of missing global data declarations, the source
code files were not set up correctly and you must modify one or more of them.
For example:
1. Suppose that the original SAVEGLOBALS compilation source file is COMP1 in Example 338
(page 375).
Example 338 Original SAVEGLOBALS Compilation Source File
! COMP1
?FIELDALIGN (SHARED2)
name x;
?source FILE1
?source FILE2
...
Saving and Using Global Data Declarations 375