Guardian Programmer's Guide

Table Of Contents
Using Nowait Input/Output
Guardian Programmer’s Guide 421922-014
4 - 23
Nowait I/O: An Example
!------------------------------------------------------------
! This is the main procedure. It calls the INIT procedure to
! initialize and then goes into a loop calling GET^COMMAND
! to get the next user request and calling the procedure
! to carry out that request.
!------------------------------------------------------------
PROC LOGGER MAIN;
BEGIN
STRING CMD;
CALL INIT;
! Loop indefinitely:
WHILE 1 DO
BEGIN
! Prompt the user to log on:
CALL LOGON;
! Loop until user types "x" or does not answer a prompt:
WHILE LOGGED^ON DO
BEGIN
! Prompt for the next command.
CMD := GET^COMMAND;
! Call the function selected by user:
CASE CMD OF
BEGIN
"r", "R" -> CALL READ^RECORD;
"a", "A" -> CALL APPEND^RECORD;
"x", "X" -> LOGGED^ON := 0;
OTHERWISE -> CALL INVALID^COMMAND;
END;
END;
END;
END;