Guardian Programmer's Guide

Table Of Contents
Communicating With Terminals
Guardian Programmer’s Guide 421922-014
10 - 8
Timing Out Terminal Response
SBUFFER ':=' [%33,"a",%21] -> @S^PTR;
WCOUNT := @S^PTR '-' @SBUFFER;
CALL WRITEREADX(TERMNUM,
SBUFFER,
WCOUNT,
BUFSIZE,
COUNT^READ);
IF <> THEN ...
After the WRITEREADX procedure finishes, SBUFFER contains the seven-character
cursor address and 7 is returned in COUNT^READ.
Timing Out Terminal Response
Operations with terminals require human response and therefore can take an indefinite
time. You can use the timelimit parameter of the AWAITIOX procedure to ensure
that the operation is completed within a given period of time. To do this, you must have
the terminal open to permit nowait I/O.
The following example prompts a user for an account number. If no response is
received within five minutes, the user is prompted again:
DEFINE FIVE^MINUTES = 30000D#;
LITERAL TIMEOUT = 40;
INT ERROR, .SBUFFER[0:599];
.
.
WHILE PROMPT = YES DO
BEGIN
PROMPT := NO;
SBUFFER ':=' "Please Enter Account Number" -> @S^PTR;
CALL WRITEREADX(TERMNUM,
SBUFFER,
@S^PTR '-' @SBUFFER,
BUFSIZE ,
COUNT^READ);
IF <> THEN ...
CALL AWAITIOX(TERMNUM,
!buffer^address!,
COUNT^READ,
TAG,
FIVE^MINUTES);
IF <> THEN
BEGIN
CALL FILE_GETINFO_(TERMNUM,
ERROR);
IF ERROR = TIMEOUT THEN PROMPT = YES
ELSE ....
END;
END;
The above program issues the prompt “Please Enter Account Number” every five
minutes until the operator responds.