Guardian Programmer's Guide

Table Of Contents
Communicating With Printers
Guardian Programmer’s Guide 421922-014
11 - 30
Recovering From a “Device Not Ready” Error
Recovering From a “Device Not Ready” Error
Your application must be able to handle a “not ready” or “paper out” condition. With
some printers, either condition causes a “device not ready” error (refer to the printer
manual). If either of these conditions arises, your program should send a message to
the user or system operator. Your application should then wait for the user to respond,
indicating that the printer is ready.
The FILEERROR procedure is useful with devices that might generate retryable errors.
You should call this procedure after checking the condition code following an I/O
operation with the printer. FILEERROR returns a status value of 1 if the operation
should be retried or 0 if it should not be retried. For errors that need to be retried,
FILEERROR responds as follows:
For error 100 or error 102, FILEERROR displays an appropriate message on the
home terminal and waits for a reply. The user is then expected to fix the problem
before typing a reply. To continue, the user presses the return key; FILEERROR
returns 1. To discontinue, the user enters STOP; FILEERROR returns 0.
For path errors (errors 200 through 255) FILEERROR returns 1 where it is
appropriate for your program to retry the operation. For errors 200 and 201,
FILEERROR returns a 1 if it can establish a path to the file in error; otherwise, it
returns 0. For errors 240 and 241, FILEERRORS always returns a 1. For other
path errors, FILEERRORS always returns a 0.
The following example shows one way of using the FILEERROR procedure:
ERROR := 1;
WHILE ERROR DO
BEGIN
CALL WRITEX(PRINTERNUM,SBUFFER,WCOUNT);
IF <> THEN
BEGIN
IF NOT FILEERROR(PRINTERNUM) THEN
CALL PROCESS_STOP_(!process^handle!,
!specifier!,
ABEND);
END;
ELSE ERROR := 0;
END;
Recovering From Path Errors
Path-error recovery on a printer requires some special considerations because of
paper movement. If a path error is detected and it is either error 200 or 201, the
operation never got started. These operations can be retried if one of these errors
occurs.
If a path error is detected and it is one of errors 210 through 231, the operation failed at
some indeterminate point and paper movement may have occurred. Depending on the
application, different approaches to error recovery are required. If the operation is
critical, such as printing payroll checks, the check should be canceled and a message