Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 18
Flushing the Buffer
BUFFERED^MODE,
ENABLED);
The FILE_OPEN_ request need not specify exclusive access in the call; the tape
process enforces exclusive access by disallowing further opens if buffered mode is
enabled and by disallowing buffered mode if there is more than a single opener. Error
12 (file in use) is returned if the SETMODE request is rejected for this reason.
The SETMODE call to enable buffered-mode operation also fails if the tape process
cannot allocate an I/O segment for its buffers. If the allocation fails, operation
continues in unbuffered mode and error 33 (no buffer space) is returned by the
SETMODE call.
Buffered mode remains enabled until the application closes the device or disables
buffered mode by calling SETMODE; for example:
LITERAL BUFFERED^MODE = 99,
ENABLED = 1,
DISABLED = 0;
.
.
CALL SETMODE(TAPE^NUM,
BUFFERED^MODE,
DISABLED);
If buffered mode is disabled using SETMODE while buffered writes are waiting to be
written to tape, the SETMODE does not finish until all outstanding write operations
have completed or an error occurs. Thus, a SETMODE during a buffered write
sequence behaves like any request other than a write request: an error is returned to
indicate that a previous write operation did not finish successfully.
The SETMODE request to enable buffered mode, when issued while already operating
in buffered mode, can serve as a checkpoint operation to allow an application to
confirm that all previous write operations have finished successfully and that the data
was written to tape. This is true of any request (except WRITE[X]) issued after a
sequence of WRITE[X] requests. There is no explicit request that is defined for this
checkpointing purpose.
In all cases, the application must check the error code returned from the SETMODE
request to be sure of its success.
Flushing the Buffer
You can cause the tape process to write the contents of its buffer to tape and
synchronize the drive by issuing the CONTROL 26 operation. You can use this
operation following a write or a write end-of-file mark operation:
LITERAL SYNCHDATA = 26;
.
.
CALL CONTROL(TAPE^NUM,
SYNCHDATA);