ansitape.5 (2012 03)

ANSITAPE(5) ANSITAPE(5)
The HDR3 and HDR4 labels are not written on IBM tapes. ANSI allows, but does not
require, these labels.
Field Width Example Use
HDR3 4 HDR3 Third file header.
OS 76 Operating-system dependent.
OS This field is reserved for the use of the operating system that created the file. Other
operating systems are supposed to disregard HDR3 records. On VAX/VMS, this record
contains the RMS file description.
Field Width Example Use
HDR4 4 HDR4 Fourth file header.
Name 2 63 Name continuation from HDR1
Unknown 2 00 Unknown, fill with 00.
IGN 11 << ignored >>
Name 2 On ANSI tapes, if the filename is longer than 17 characters, the first 17 are placed in
the HDR1 record. The next 63 are put in HDR4. Filenames longer than 80 characters
are truncated. Note that it is not required to have a HDR3 record in order to have a
HDR4.
FILE TRAILING LABELS
These labels are written after a tape file. For every label written at the head of the file, there will be a
corresponding label at the tail. Except for the block count field in HDR1, the only difference is in the
name of the label. If we have reached the logical end of the file, the characters HDR in the headers are
replaced by the characters EOF in the trailing labels. If we are not at the logical end of the file, but are
merely pausing at the physical end of tape before continuing on another reel, the HDR characters are
replaced by EOV (end-of-volume).
The block count field of HDR1 was initially recorded as 000000. When the trailers are written, the block
count is changed to indicate the number of tape data blocks written. A file that is continued over several
volumes maintains separate counts for each reel.
RECORD FORMATS
The two basic record formats are fixed and variable.
Fixed format uses records that are all constant length. This is the case with VAX/VMS executable images
(record length = 512). It is also used by IBM systems for text files, with a record length of 80 (card
images). The record size field of HDR2 tells how long each record is.
With fixed-length records, the blocksize is usually selected to be some multiple of the recordsize. As many
records as will fit are placed in each block. Since records do not (normally) span physical tape blocks,
extra space at the end of a block is wasted.
Variable-length records are used by VAX/VMS for text files. The Unix program ansitape(1) also turns
Unix text files into variable-length tape files. With this format, the record length specified in HDR2 is an
upper limit.
Each record is preceeded by a 4-digit (zero-filled) byte count. The count included the digits themselves, so
the minimum valid number is 0004. These four digits specify how long the record is. The data follows
the digits, and is in turn followed by the digits for the next record.
When writing, ansitape checks to make sure that there is enough room in the tape block for the next
record. If the record (including its length digits) won’t fit, the current block is sent to the tape, and a new
block is started. Unused space at the end of the tape block is filled with circumflex (ˆ) characters.
4 Hewlett-Packard Company 4 HP-UX 11i Version 3: March 2012