Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 76
Using the SIO Procedures: An Example
!------------------------------------------------------------
! Procedure to prompt the user for the next function to
! perform:
!
! "r" to read records
! "a" to append records
! "x" to exit the program
!
! The selection made is returned as the result of the call.
!------------------------------------------------------------
INT PROC GET^COMMAND;
BEGIN
INT COUNT^READ;
! Prompt the user to read, append, or exit the program:
PRINT^STR("Type 'r' for Read Log, ");
PRINT^STR("Type 'a' for Append to Log, ");
PRINT^STR("Type 'x' for Exit. ");
PRINT^BLANK;
SBUFFER ':=' "Choice: " -> @S^PTR;
CALL READ^FILE(INFILE,BUFFER,COUNT^READ,
@S^PTR '-' @SBUFFER);
SBUFFER[COUNT^READ] := 0;
RETURN SBUFFER[0];
END;