Accessing Files Programmer's Guide (32650-90885)

116 Chapter7
Record Selection and Data Transfer
Magnetic Tape Considerations
Figure 7-2. Magnetic Tape Markers
As far as the magnetic tape hardware and software are concerned, the BOT marker is
much more significant than the EOT marker because BOT signals the start of recorded
information; but EOT simply indicates that the remaining tape supply is running low, and
the program writing the tape should bring the operation to an orderly conclusion. The
difference in treatment of these two physical tape markers is reflected by the file system
intrinsics when the file being read, written, or controlled is a magnetic tape device file. The
following paragraphs discuss the characteristics of each appropriate intrinsic.
FWRITE. If the magnetic tape is unlabeled (as specified in the HPFOPEN/FOPEN intrinsic or
FILE command) and a user program attempts to write over or beyond the physical EOT
marker, the FWRITE intrinsic returns an error condition code (CCL). The actual data is
written to the tape, and a call to FCHECK reveals a file error indicating end-of-tape. All
writes to the tape after the EOT marker has been crossed transfer the data successfully,
but return a CCL condition code until the tape crosses the EOT marker again in the
reverse direction (rewind or backspace).
If the magnetic tape is labeled (as specified in the HPFOPEN/FOPEN intrinsic or FILE
command), a CCL condition code is not returned when the tape passes the EOT marker.
Attempts to write to the tape after the EOT marker is encountered cause end-of-volume
(EOV) labels to be written. A message then is printed on the operator's console requesting
another reel of tape to be mounted.
FREAD. A user program can read data written over an EOT marker and beyond the
marker into the tape trailer. The intrinsic returns no error condition code (CCL or CCG)
and does not initiate a file system error code when the EOT marker is encountered.
DDS tape drives do not permit an FREAD past the marker. With DDS drives, every FWRITE
updates the EOT marker and does not permit a rewrite of previous data.
FSPACE. A user program can space records over or beyond the EOT marker without
receiving an error condition code (CCL or CCG) or a file system error. The intrinsic does,
however, return a CCG condition code when a logical file mark is encountered. If the user
program attempts to backspace records over the BOT marker, the intrinsic returns a CCG
condition code and remains positioned on the BOT marker.
FCONTROL (Write EOF). If a user program writes a logical end-of-file (EOF) mark on a
magnetic tape over the reflective EOT marker, or in the tape trailer after the marker,
hardware status is saved to return END-OF-TAPE on the next FWRITE. The file mark is
actually written to the tape.