Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 61
Handling Fatal Errors
SET^PRINT^ERR^MSG,
NEW^VALUE);
Redirecting Error Messages
You can redirect error messages to an alternate file. Again you have two choices: you
can specify redirection when you open a file or you can use SET^FILE.
Use the error-file-fcb parameter in the OPEN^FILE procedure to set the error-
message file while opening a file. The following example redirects error messages to
the output file:
CALL OPEN^FILE(COMMON^FCB,
INPUT,
!block^buffer!,
!block^bufferlen!,
!flags!,
!flags^mask!,
!max^record^len!,
!prompt^char!,
OUTPUT);
It does not matter which file you are opening when you redirect error messages. The
last error file specified is the one used for all SIO files. If you do not supply the
error-file-fcb parameter, then the error file does not change.
To use the SET^FILE procedure to set the error file, choose the SET^ERRORFILE
operation. You must specify the common FCB in the first parameter and the error-file
FCB in the third parameter. The following example redirects error messages to a file
with FCB name EFILE:
CALL SET^FILE(COMMON^FCB,
SET^ERRORFILE,
EFILE);
Handling Fatal Errors
There are two classes of fatal errors: errors that occur when an SIO file is opened and
errors that occur when the open file is accessed. For both classes of fatal error, you
have the option of letting the process automatically terminate or allowing the process to
continue in spite of the error.
Handling Open Errors
You can use the ABORT^OPENERR flag to choose whether to abort the process in
response to a fatal error returned by the OPEN^FILE call.
The effects of setting or clearing the ABORT^OPENERR flag are explained below:
Setting the ABORT^OPENERR flag causes the system to respond to fatal open
errors by closing all files opened by the process, issuing an error message, and