Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 66
Writing the Program
!------------------------------------------------------------
! Procedure to process an illegal command. The procedure
! informs the user that the selection was other than "r,"
! "a," "c," or "x."
!------------------------------------------------------------
PROC ILLEGAL^COMMAND;
! If user selects other than r, a, c, or x:
BEGIN
PRINT^BLANK;
! Inform the user that the selection was invalid
! then return to prompt again for a valid function:
PRINT^STR("ILLEGAL COMMAND: " &
"Type one of 'r,' 'a,' 'c,' or 'x.'");
END;
!------------------------------------------------------------
! Procedure to prompt the user for the next function to be
! performed:
!
! "r" to read records
! "a" to append records
! "c" to create a file and 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 for the function to be performed:
PRINT^BLANK;
PRINT^STR("Type 'r' for Read Log, ");
PRINT^STR(" 'a' for Append to Log, ");
PRINT^STR(" 'c' for Create File and Append, ");
PRINT^STR(" 'x' for Exit. ");
PRINT^BLANK;
SBUFFER ':=' "Choice: " -> @S^PTR;
CALL WRITEREADX(TERMNUM,SBUFFER,@S^PTR '-' @SBUFFER,
BUFSIZE,COUNT^READ);
IF <> THEN CALL FILE^ERRORS(TERMNUM);
SBUFFER[COUNT^READ] := 0;
RETURN SBUFFER[0];
END;