TAL Programmer's Guide
Modular Programming Example
Sample Programs
096254 Tandem Computers Incorporated A–7
Modular Programming
Example
This modular programming example illustrates how you can divide the code for a
program into separately compilable modules. The program converts records in the
input file to a different format and length by reordering fields and adding fields to
records. The example includes:
A brief description of program characteristics
Partial listings of module code
Load maps for the program file
Compilation statistics (compile and bind) for the program file
Selected listings show the handling of data and program structure. The content of
global data blocks appear only in the module that declares them. In modules that
reference such blocks, NOLIST prevents the listing of the content of the blocks.
Compilation maps and statistics are not shown for each module. Load maps show
global-data-block entries that do not exist after compilation, such as LITERALs. The
mainline load map does not refer to these blocks.
Modular Structure The program consists of five modules, shown in Examples A-6a through A-6e. Each
module performs a single operation. The structure of the modules and their
procedures allows changes to one operation without the need to recompile the others.
Information is accessible across modules on an as-needed basis. They share named
global data blocks and pass information as parameters and local data such as a simple
pointer to the locally declared record buffer. The named global data block
DEFAULT_VOL contains shared run-time data. Other named blocks declare structure
templates for record definitions and LITERAL declarations, which use no memory.
Procedures within a module share global data in private blocks.
The following table summarizes the blocks used by each module. (The symbol (P)
denotes a private block.)
Module Name Blocks Defined Blocks Referenced
TPR_CONVERT RECORD_DEFS MSG_LITERALS
INITIALIZATION_MODULE DEFAULT_VOL
MESSAGE_MODULE MSG_LITERALS
MESSAGE_MODULE (P)
DEFAULT_VOL
IN_FILE_HANDLER IN_DATA
IN_FILE_HANDLER (P)
MSG_LITERALS
DEFAULT_VOL
OUT_FILE_HANDLER OUT_DATA
OUT_FILE_HANDLER (P)
DEFAULT_VOL
MSG_LITERALS