Guardian Programmer's Guide

Table Of Contents
Using Nowait Input/Output
Guardian Programmer’s Guide 421922-014
4 - 21
Nowait I/O: An Example
!------------------------------------------------------------
! Procedure to process an invalid command. The procedure
! informs the user that the selection was other than "r,"
! "a," or "x."
!------------------------------------------------------------
PROC INVALID^COMMAND;
BEGIN
PRINT^BLANK;
! Inform the user that the selection was invalid and then
! return to prompt again for a valid function:
PRINT^STR ("INVALID COMMAND: " &
"Type either 'r,' 'a,' or 'x'");
END;
!------------------------------------------------------------
! Procedure to initialize the program. It calls
! INITIALIZER to dispose of the startup sequence of messages.
! It opens the home terminal and the data file used by the
! program.
!------------------------------------------------------------
PROC INIT;
BEGIN
STRING .LOGNAME[0:MAXFLEN - 1]; !name of log file
INT LOGLEN; !length of log name
STRING .TERMNAME[0:MAXFLEN - 1]; !terminal file
INT TERMLEN; !length of term name
INT ERROR;
! Read and discard startup sequence of messages.
CALL INITIALIZER;
! Open the terminal file for nowait I/O. For simplicity
! this program uses the home terminal; the recommended
! approach is to use the IN file read from the Startup
! message; see Section 8, Communicating With a TACL Process,
! for details:
CALL PROCESS_GETINFO_(!process^handle!,
!file^name:maxlen!,
!file^name^len!,
!priority!,
!moms^processhandle!,
TERMNAME:MAXFLEN,
TERMLEN);
ERROR := FILE_OPEN_(TERMNAME:TERMLEN,
TERMNUM,
!access!,
!exclusion!,
1);