Guardian Programmer's Guide

Table Of Contents
Using DEFINEs
Guardian Programmer’s Guide 421922-014
7 - 20
Using DEFINEs: An Example
!-----------------------------------------------------------
! Procedure for displaying file-system error numbers on the
! terminal. The parameters are the file name, length, and
! error number. This procedure is mainly to be used when
! the file is not open, so there isn't a file number for it.
! FILE^ERRORS is to be used when the file is open.
!
! The procedure also stops the program after displaying the
! error message.
!-----------------------------------------------------------
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(TERMNUM,SBUFFER,@S^PTR '-' @SBUFFER);
! Terminate the program:
CALL PROCESS_STOP_(!process^handle!,
!specifier!,
ABEND);
END;