Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 6
Setting Up the SIO Data Structures
1. Allocate space for the SIO data structures using TAL or pTAL DEFINEs provided in
the $SYSTEM.SYSTEM.GPLDEFS file. You need to allocate space for each FCB,
the RUCB, and the common FCB. The DEFINEs also provide initial values.
2. Assign a logical file name to each file that the SIO procedures will access
(optional).
3. Complete the initialization of the FCBs by calling the INITIALIZER procedure.
INITIALIZER uses information from the Startup and Assign messages to
supplement information already in the FCBs.
4. Set file characteristics such as access mode, block size, and extent size for each
SIO file (optional). These characteristics can supplement or override those already
written to the FCBs by the INITIALIZER procedure.
The following paragraphs describe how to perform these steps.
Setting Up the SIO Data Structures
Setting up the FCBs, the common FCB, and the RUCB for the INITIALIZER procedure
requires the use of some TAL or pTAL DEFINEs and literals that are described in the
$SYSTEM.SYSTEM.GPLDEFS file. To use these templates, you must source this file
into your program with a compiler directive as follows:
?NOLIST, SOURCE $SYSTEM.SYSTEM.GPLDEFS
?LIST
Setting Up the Run-Unit Control Block and the Common File
Control Block
Use a DEFINE named ALLOCATE^CBS to set up the RUCB and the common FCB.
You must specify the following information:
The name of the RUCB. You will pass this name to the INITIALIZER procedure.
The name of the common FCB. You will pass this name to the OPEN^FILE
procedure.
The number of additional FCBs that the INITIALIZER procedure will prepare. This
number must be the total number of files that INITIALIZER will access.
The following example sets up an RUCB named CONTROL^BLOCK. It specifies a
common FCB named COMMON^FCB. The INITIALIZER procedure will set up two
additional FCBs:
LITERAL NUMBER^OF^FCBS = 2;
ALLOCATE^CBS(CONTROL^BLOCK,
COMMON^FCB,
NUMBER^OF^FCBS);
Note. The TNS/R native form of the INITIALIZER procedure call differs from the TNS form.
See "Using the INITIALIZER Procedure," later in this section, for more details.