Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 3
Steps for Writing a Program
For ease of programming, all structures and literals required by the SIO procedures,
including the FCB and the common FCB, are predefined in a file called GPLDEFS in
the $SYSTEM.SYSTEM subvolume. This file must be sourced into your program if
you intend to use the SIO procedures.
Steps for Writing a Program
To use the SIO procedures, your program must perform the sequence of operations
outlined below:
1. Initialize every FCB that your process will use. You must initialize one FCB for
each file to be accessed by SIO procedures, and a common FCB. You can do this
in one of the following ways:
²
Using TAL or pTAL DEFINEs, you can allocate FCBs with some values already
initialized. Allocation is static and is done at compile time. The INITIALIZER
procedure provides further initial values for the FCBs, such as information
provided in ASSIGN commands. INITIALIZER also provides a convenient way
to complete FCB initialization without having to directly handle the $RECEIVE
file. The subsection Initializing SIO Files Using TAL or pTAL DEFINEs, later in
this section, provides details.
²
You can allocate space for FCBs and initialize them by issuing SET^FILE
procedure calls. This method does not have the convenience of the
INITIALIZER procedure, but it gives you the flexibility to dynamically allocate
FCBs and is therefore appropriate if you do not know how many FCBs you will
need. The $RECEIVE file is handled directly. Initializing SIO Files Using TAL
or pTAL DEFINEs, later in this section, provides details.
²
You can mix the above methods: you can allocate some FCBs using TAL or
pTAL DEFINEs and dynamically allocate additional FCBs and initialize them
using SET^FILE procedure calls.
2. Open each FCB required by the program. You must use the OPEN^FILE
pro
cedure as described in the subsection
Opening and Creating SIO Files, later in
this section.
3. Perform any other SIO operations as required by your application. These
operations may include reading or writing the SIO files or other operations such as
processing the BREAK key.
4. Close the SIO files as described in the subsection Closing SIO Files, later in this
section.
Differences Between TNS/R Native and TNS Procedures
Most of the SIO procedures can be called by either a TNS/R native caller or a TNS
caller with no changes. However, three of the procedure calls, the SET^FILE,
Note. TNS/R native callers cannot use TNS FCBs, nor can TNS callers use native FCBs.