Asynchronous Terminals and Printer Processes Programming Manual

PROCEDURE CALLS FOR ACCESSING TERMINALS
AWAITIO
Example
An application program prompts a terminal operator for an account
number. If the operator does not respond within 5 minutes, the
program reminds the operator by sending another prompt. To do
this, include code similar to the following in your program:
.
DEFINE FIVE^MINUTES = 30000D#; ! 300 seconds
LITERAL TIMEOUT = 40;
INT ERROR,
.BUFFER[0:599];
.
.
REPROMPT:
.
BUFFER ':=' "PLEASE ENTER ACCOUNT NUMBER";
CALL WRITEREAD (TERM^NUM,BUFFER,27,400,NUM^READ,TAG);
IF < THEN ... ! checks if WRITEREAD was successful
CALL AWAITIO (TERM^NUM,BUFFER,NUM^READ,TAG,FIVE^MINUTES);
IF < THEN ! error occurred
BEGIN
CALL FILEINFO (TERM^NUM,ERROR);
IF ERROR = TIMEOUT THEN GO TO REPROMPT
ELSE
END;
.
The message, "PLEASE ENTER ACCOUNT NUMBER," is issued every 5
minutes until the operator responds.
If the call to AWAITIO is for any file (for example,
file-number
= -1) and a timeout occurs, the operation pending on the terminal
must be canceled before the WRITEREAD can be reinitiated.
SETPARAM
A SETPARAM 3 procedure call sets and fetches the parameters for
handling a break indication from a terminal. The syntax of
SETPARAM is as follows:
3-5