Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 71
Using the SIO Procedures: An Example
@OUTFILE := @INFILE
ELSE
! If the process is not run interactively, initialize
! the output file:
BEGIN
CALL SET^FILE(OUTFILE,INIT^FILEFCB);
! The following statement calls a DEFINE which executes the
! appropriate (native or TNS) form of the SET^FILE
! call.
CALL_SET^FILE_ADDRESS_(ERROR,OUTFILE,ASSIGN^FILENAME,
@BUFFER[21]);
CALL SET^FILE(OUTFILE,ASSIGN^OPENACCESS,
WRITE^ACCESS);
END;
! Initialize the data file:
CALL SET^FILE(DFILE,INIT^FILEFCB);
CALL SET^FILE(DFILE,ASSIGN^OPENACCESS,
READWRITE^ACCESS);
END;
!------------------------------------------------------------
!Main procedure
!------------------------------------------------------------
PROC SIO^PROG MAIN;
BEGIN
CALL INIT;
.
.
END;
Using the SIO Procedures: An Example
The TAL sample program given below uses SIO procedures to access data on disk.
The disk file can be any type of disk file: structured, unstructured, or an EDIT file. The
user of the home terminal accesses the data.
The program expects the names of the terminal and disk files to be supplied as the
input and output file names in the Startup message. Moreover, the program will fail if
the input file is not a terminal or the output file is not a disk file.
To run the program, use a RUN command such as the following:
1> RUN OBJ^FILE/OUT DATAFILE/