TAL Programmer's Guide
Declaring Global Data
Structuring Programs
096254 Tandem Computers Incorporated 3–5
Declaring Global Data Global data is data that can be accessed by all compilation units in the program.
Global data can be any data item listed in Table 3-1 earlier in this section.
All global data declarations except LITERALs and DEFINEs must appear before any
procedure declarations. Global LITERAL and DEFINE declarations can appear
between procedures as well.
You can declare unblocked or blocked data.
Declaring Unblocked
Global Data
Unblocked global data are those you declare outside of BLOCK declarations
(described next). Place all unblocked data declarations after the NAME declaration, if
present, and before any BLOCK declarations. Identifiers of unblocked global data are
accessible to all compilation units in the program.
Declaring Blocked
Global Data
Blocked global data are those you declare within BLOCK declarations. The BLOCK
declaration lets you group global data into named or private data blocks. All BLOCK
declarations must appear after the NAME declaration and any unblocked data
declarations and before the first procedure declaration.
Declaring Named Data Blocks
Use a named data block for global data you want to share with other compilation units
in the program. You can include any number of named data blocks in a compilation
unit. The data declarations in a data block can be any data type:
BLOCK shared_data;
INT flag := True;
INT(32) index := 0;
STRING count := 0;
END BLOCK;
Declaring Private Data Blocks
Use a private data block for global data you want to share only with procedures within
the current compilation unit. You can declare only one private data block in a
compilation unit. The private data block inherits the identifier you specify in the
NAME declaration.
BLOCK PRIVATE;
INT average;
INT total;
END BLOCK;
For more information about global data blocks, see Section 14, “Compiling Programs.”