Guardian Programmer's Guide

Table Of Contents
Writing a Requester Program
Guardian Programmer’s Guide 421922-014
21 - 23
Coding the Requester Program
!------------------------------------------------------------
! Procedure for displaying file system error numbers on the
! terminal. The parameters are the file name and its length
! and the error number. This procedure is used when the
! file is not open, so there is no file number for it.
! FILE^ERRORS is used when the file is open.
!------------------------------------------------------------
PROC FILE^ERRORS^NAME(FNAME:LEN,ERROR);
STRING .FNAME;
INT LEN;
INT ERROR;
BEGIN
! Compose and print the message:
START^LINE;
PUT^STR("File system error ");
PUT^INT(ERROR);
PUT^STR(" on file " & FNAME for LEN );
CALL WRITEX(TERM^NUM,SBUFFER,@S^PTR '-' @SBUFFER);
START^LINE;
PUT^STR("occurred in requester program ");
CALL WRITEX(TERM^NUM,SBUFFER,@S^PTR '-' @SBUFFER);
! Terminate the program:
CALL PROCESS_STOP_;
END;
!------------------------------------------------------------
! 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.
! FILE^ERRORS^NAME is called to display the information.
!
! 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;