Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 10
Assigning a Logical File Name
The following examples allocate space for two FCBs, one for the input file and one for
the output file. The default file names for the input and output files will be read from
the Startup message by the INITIALIZER procedure:
ALLOCATE^FCB(INFILE," #IN ");
ALLOCATE^FCB(OUTFILE," #OUT ");
The following example allocates space for an FCB for an explicitly named disk file:
ALLOCATE^FCB(DFILE,"$OURVOL MYSUBVOLDATA ");
Assigning a Logical File Name
To enable ASSIGN commands to set file characteristics through the INITIALIZER, you
must provide a logical file name for the FCB. This step is redundant if your program
will always set file characteristics using only the SET^FILE procedure.
To assign a logical file name, supply the SET^FILE procedure with the address of an
array. The first byte of the array indicates the number of characters in the name;
subsequent bytes contain the name, which can be up to seven characters long.
The following example provides logical file names for the FCBs allocated above.
Three versions of the example are shown: a pTAL version, a TAL version, and a
version that uses the CALL_SET^FILE_ADDRESS_ DEFINE to call the correct form of
SET^FILE in either environment. See Differences Between TNS/R Native and
TNS Procedures, earlier in this section, for details.
pTAL Example:
INT .BUF[0:11];
STRING .SBUF = BUF;
.
.
SBUF ':=' [5, "INPUT"]
CALL SET^FILE(INFILE,
ASSIGN^LOGICALFILENAME,
,,
@BUF);
SBUF ':=' [6, "OUTPUT"];
CALL SET^FILE(OUTFILE,
ASSIGN^LOGICALFILENAME,
,,
@BUF);
SBUF ':=' [5, "LFILE"];
CALL SET^FILE(DFILE,
ASSIGN^LOGICALFILENAME,
,,
@BUF);
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.