Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 88
Recovering From Path Errors
(device not ready) or error 218 (interrupt timeout). After power is restored and the tape
unit is again accessed, a subsequent call to FILE_GETINFO_ returns error 153 (tape
drive power on). It is the responsibility of the application to ensure the correct tape is
loaded following a power failure.
Tape units, if a tape is loaded, are automatically put back into an operating (ready)
state when power is restored.
The position of the tape following power restoration depends on the drive type. You
must therefore use care if you need to ensure that your code is device independent.
Vacuum drives, for example, will move the tape when the power is lost; these drives
automatically rewind the tape when power is restored. Some types of drives do not
move the tape when power is lost; for these drives you can continue without having to
reposition the tape.
Recovering From Path Errors
The system software usually corrects for path errors by finding an alternate path to the
device, unless it is the tape unit itself that has the problem.
Typically, your program will retry the operation. Exactly what else the program must
do, however, depends on whether the tape may have moved and on whether your
program is executing in buffered mode.
If error 200 or 201 is detected, the operation never got started. You can simply retry
the operation for an application that is not executing in buffered mode. If the
application is executing in buffered mode, there is no way to tell which operation
initiated the error. Your program must backtrack to a known point of consistency and
then play back all operations done since that time. Refer to Working in Buffered Mode,
earlier in this section.
If your application detects an error in the range 210 through 231, then the operation
failed at some indeterminate point. Tape motion may have occurred. These failures
cause the tape process to switch to its backup process, so the next operation is tried in
the alternate CPU.
There are several ways to handle path errors in the range 210 through 231:
If a path error occurs during a write, space backward one record and read the
record. If a parity error occurs, then it is clear that the write had been partially
completed; backspace again and retry the write operation. If there is no parity
error, then the write finished successfully.
Keep track of the number of records read or written. Then, if an error of this type
occurs, rewind the tape and space forward the appropriate number of records and
reinitiate the operation.
If writing, write a sequence number as part of each record written. If one of these
errors occurs, retry the operation and continue. Then when reading the tape,
discard all but the last record containing duplicate sequence numbers.