Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 68
Sample Initialization
When dynamically allocating FCBs, you can set parameters only by using the
SET^FILE procedure, not by using ASSIGNs. See Setting Up File Access earlier in
this section for details.
Sample Initialization
The following procedure performs the same operations as the sample initialization
shown earlier in this section under “Initializing SIO Files With the INITIALIZER
Procedure.” This example, however, does not use INITIALIZER.
The procedure works like this: The names of the input and output files are delivered to
the process through the Startup message. The procedure checks to see whether
these names refer to the same process or terminal file. If so, that file is assigned
read/write access. If the input and output files are different, then the input file is
assigned read-only access and the output file write-only access.
?INSPECT, SYMBOLS, NOCODE, NOMAP
?NOLIST
?SOURCE $SYSTEM.ZSYSDEFS.SZYSTAL
?SOURCE $SYSTEM.SYSTEM.GPLDEFS
?LIST
INT INTERACTIVE,
ERROR,
.COMMON^FCB[0:FCBSIZE^D00 - 1] := 0,
.RCV^FILE[0:FCBSIZE^D00 - 1],
.INFILE[0:FCBSIZE - 1],
.OUTFILE[0:FCBSIZE - 1],
.DFILE[0:FCBSIZE - 1],
.BUFFER[0:99],
.MOMSPHANDLE[0:ZSYS^VAL^PHANDLE^WLEN - 1],
.MYPHANDLE[0:ZSYS^VAL^PHANDLE^WLEN - 1],
DEVTYPE,
LENGTH,
JUNK;
LITERAL PROCESS = 0,
TERMINAL = 6;
?NOLIST
?SOURCE
$SYSTEM.SYSTEM.EXTDECS0(SET^FILE,OPEN^FILE,PROCESS_GETINFO_,
? READ^FILE,WAIT^FILE,CLOSE^FILE, DEVICEINFO,FNAMECOMPARE,
? PROCESS_STOP_, PROCESS_GETPAIRINFO_,
? PROCESSHANDLE_GETMINE_)
?LIST
Note. The following initialization procedure will execute in both the native and TNS
environments. The procedure uses the CALL_SET^FILE_ADDRESS_. DEFINE to select the
appropriate (pTAL or TAL) form of the SET^FILE procedure call in cases where the SET^FILE
call passes an address value.