Guardian Programmer's Guide

Table Of Contents
Using Nowait Input/Output
Guardian Programmer’s Guide 421922-014
4 - 15
Nowait I/O: An Example
!-----------------------------------------------------------
! Procedure for displaying file-system error numbers on the
! terminal. The parameter is the file number. The file
! name and error number are determined from the file number
! and FILE^ERRORS^NAME is then called to do the display.
!
! FILE^ERRORS^NAME also stops the program after displaying
! the error message.
!-----------------------------------------------------------
PROC FILE^ERRORS(FNUM);
INT FNUM;
BEGIN
INT ERROR;
STRING .FNAME[0:MAXFLEN-1];
INT FLEN;
CALL FILE_GETINFO_(FNUM,ERROR,FNAME:MAXFLEN,FLEN);
CALL FILE^ERRORS^NAME(FNAME:FLEN,ERROR);
END;
!-----------------------------------------------------------
! Procedure to write a message on the terminal and check
! for any error. If there is an error, this procedure
! attempts to write a message about the error and then
! stops the program.
!-----------------------------------------------------------
PROC WRITE^LINE(BUF,LEN);
STRING .BUF;
INT LEN;
BEGIN
CALL WRITEX(TERMNUM,BUF,LEN);
IF <> THEN CALL FILE^ERRORS(TERMNUM);
CALL AWAITIOX(TERMNUM);
IF <> THEN CALL FILE^ERRORS(TERMNUM);
END;