Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 44
Waiting for Any File
!prompt^count!,
!max^read^count!,
1);
CALL READ^FILE(TERM2,READ^BUFFER,BYTES^READ,
!prompt^count!,
!max^read^count!,
1);
!Use the AWAITIO call to receive the first I/O to finish:
FNUM := -1;
CALL AWAITIO(FNUM,
!buffer^address!,
RCOUNT);
!If response received from terminal 1:
IF FNUM := T1^FNUM THEN
BEGIN
!Establish the error value caused by AWAITIO:
CALL FILE_GETINFO_(T1^FNUM,ERROR);
!Update the FCB to indicate I/O complete:
CALL SET^FILE(TERM1,SET^PHYSIOOUT,0);
!Update the FCB with the number of bytes transferred:
CALL SET^FILE(TERM1,SET^COUNTXFERRED,RCOUNT);
!Update the FCB with the error number returned from
!the FILE_GETINFO_ call following AWAITIO:
CALL SET^FILE(TERM1,SET^ERROR,ERROR);
!Update the file-state information:
CALL WAIT^FILE(TERM1,BYTES^READ);
!Process the read from terminal 1
.
.
END
ELSE