Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 17
Invoking and Revoking Buffered-Mode Operation
file-system errors, an application closing the tape process when buffers are awaiting
completion cannot be sure those data records have been successfully written to tape.
If the application issues a close request against an unlabeled tape while write requests
are still outstanding, then the data on tape is not terminated with an end-of-file mark.
Any application that later tries to read the tape will not encounter the conventional two
end-of-file marks that indicate the logical end of the tape. The application might
therefore encounter a runaway tape condition or incorrect data.
The above situation can occur when the system closes the tape file for an application
that is stopping or abending. Also, note that this is no different from unbuffered
operation. The tape process does not write trailing end-of-file marks for an application
that accesses unlabeled tape.
When an application encounters an end-of-tape error, the application must stop writing
records and send the end-of-tape sequence. The EOT error is returned for write and
write-end-of-file-mark requests only.
An error indication can be reporting either a problem with the request itself or a
problem with some previous buffered write. If an error is reported on a previous
operation, the request that resulted in the error is not performed. Requests that
terminate a write sequence (typically CONTROL requests such as write-end-of-file-
mark) must allow for this.
There are no special application considerations for read sequences. Buffered-mode
reads are handled by the tape process. If buffered mode is enabled, the tape process
responds to an application read request by reading ahead of the requested record.
The requested record (or error condition) is returned to the application; the remainder
of the data read from tape remains in the tape buffer.
All other requests are performed in buffered mode as they are in unbuffered mode,
except that they can return errors from previous I/O operations.
Invoking and Revoking Buffered-Mode Operation
Buffered mode is allowed only on an exclusive basis: only a single opener can have a
device open at any one time if buffered mode is to be enabled.
Buffered mode is disabled by default.
Buffered mode is enabled by an exclusive opener through SETMODE operation 99; for
example:
LITERAL BUFFERED^MODE = 99,
ENABLED = 1,
DISABLED = 0;
.
.
CALL SETMODE(TAPE^NUM,
Note. recommends setting a tape device to unbuffered mode before closing. Doing so
ensures that all data records have been successfully written to tape.