TAL Programmer's Guide

Compiling With Relocatable Data Blocks
Compiling Programs
14–20 096254 Tandem Computers Incorporated
Sharing Global Data Blocks Because the length of any shared data block must match in all compilation units, it is
recommended that you declare all shareable global data in one source file. You can
then share that global data block with other source files as follows:
1. In the source file that declares the data block, specify the SECTION directive at the
beginning of the data block to assign a section name to the data block. The
SECTION directive remains in effect until another SECTION directive or the end
of the source file occurs:
NAME calc_unit;
?SECTION unblocked_globals !Name first section
LITERAL true = -1, !Implicit data block
false = 0;
STRING read_only_array = 'P' := [ " ","COBOL",
"FORTRAN", "PASCAL", "TAL"];
?SECTION default !Name second section
BLOCK default_vol; !Declare named block
INT .vol_array [0:7],
.out_array [0:34];
END BLOCK;
?SECTION msglits !Name third section
BLOCK msg_literals; !Declare named block
LITERAL
msg_eof = 0,
msg_open = 1,
msg_read = 2;
END BLOCK; !End msglits section
?SECTION end_of_data_sections
2. In each source file that needs to include the sections, specify the file name and the
section names in a SOURCE directive:
NAME input_file;
?SOURCE calcsrc(unblocked_globals) !Specify implicit block
?SOURCE calcsrc(default) !Specify named block
3. If you then change any declaration within a data block that has a section name,
you must recompile all source files that include SOURCE directives listing the
changed data block.