Guardian Programmer's Guide

Table Of Contents
Using Nowait Input/Output
Guardian Programmer’s Guide 421922-014
4 - 18
Nowait I/O: An Example
! Perform application-dependent check to verify the
! user name and password and set LOGGED^ON to true
! if successful. This example does no checking.
LOGGED^ON := 1;
! Erase the password as soon as it is no longer needed:
PASSWORD ':=' [PWSIZE * [" "]];
END UNTIL LOGGED^ON;
END;
!------------------------------------------------------------
! This procedure asks the user for the next function to do:
!
! "r" to read records
! "a" to append a record
! "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(" 'x' for Exit. ");
PRINT^BLANK;
SBUFFER ':=' "Choice: " -> @S^PTR;
IF WRITEREADTERM(SBUFFER,@S^PTR '-' @SBUFFER,
BUFSIZE,COUNT^READ) THEN RETURN "x";
RETURN SBUFFER[0];
END;