Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 81
Using the SIO Procedures: An Example
!------------------------------------------------------------
! Procedure to exit the program.
!------------------------------------------------------------
PROC EXIT^PROGRAM;
BEGIN
! Close all SIO files:
CALL CLOSE^FILE(COMMON^FCB);
! Stop the program:
CALL PROCESS_STOP_;
END;
!------------------------------------------------------------
! Procedure to respond to an invalid function. Any function
! other than "a," "r," or "x" calls this procedure.
!------------------------------------------------------------
PROC INVALID^SELECTION;
BEGIN
PRINT^BLANK;
! Inform user of invalid selection and then return:
PUT^STR
("Invalid Selection, you must type 'r,' 'a,' or 'x.' ");
END;
!------------------------------------------------------------
! Procedure for initializing all SIO files used by this
! application.
!------------------------------------------------------------
PROC INITIALIZE^FILES;
BEGIN
LITERAL DISK = 3; !identify process file
LITERAL TERMINAL = 6; !identify terminal file
LITERAL ABEND = 1; !to send Abend message on
! PROCESS_STOP_
INT DEVICE^TYPE; !type of device
INT PHYS^REC^LEN; !length of physical record
INT L^INFO[0:9]; !for device information
INT .INFNAME, !input file name
.OUTFNAME; !output file name
INT .BUF[0:11]; !contains a logical file name
STRING .SBUF := @BUF '<<' 1; !string pointer to BUF