TAL Programmer's Guide

Modular Programming Example
Sample Programs
A–10 096254 Tandem Computers Incorporated
Mainline Module
Example A-6a shows the mainline module, which contains the MAIN procedure. The
record-definition structures are not listed because they are translations of the Data
Definition Language (DDL) source code into TAL.
Example A-6a. D-Series Mainline Module (Page 1 of 2)
!File name CONVERTS
NAME tpr_convert;
?PUSHLIST, NOLIST, SOURCE recdefs !BLOCK RECORD_DEFS
?POPLIST
?PUSHLIST, NOLIST, SOURCE msgs (msglit)
?POPLIST !BLOCK MSG_LITERALS
!Following are external procedure declarations:
?PUSHLIST, NOLIST, SOURCE $SYSTEM.SYSTEM.EXTDECS (
? PROCESS_STOP_)
?POPLIST
?PUSHLIST, NOLIST, SOURCE inp !IN_FILE_HANDLER
?POPLIST
?PUSHLIST, NOLIST, SOURCE outp !OUT_FILE_HANDLER
?POPLIST
?PUSHLIST, NOLIST, SOURCE msgp !MESSAGE_MODULE
?POPLIST
?PUSHLIST, NOLIST, SOURCE initp !INITIALIZATION_MODULE
?POPLIST
?SECTION out_init
PROC out_init (out_rec:out_rec_len); !Initialize
STRING .EXT out_rec (out_rec_def); ! output record
INT out_rec_len;
BEGIN
IF out_rec_len '<>' 0 THEN
out_rec ':=' [" "] & out_rec FOR out_rec_len '-' 1 BYTES;
END;
?SECTION record_convert
PROC record_convert (in_rec, out_rec);
STRUCT .EXT in_rec (in_rec_def); !Convert between
STRUCT .EXT out_rec (out_rec_def); ! two records
BEGIN
INT i;
STRING .EXT ch_ptr;
i := 0;
@ch_ptr := @in_rec.name; !Copy last name