Guardian Programmer's Guide

Table Of Contents
Guardian Programmer’s Guide 421922-014
12 - 1
12
Communicating With Magnetic Tape
Magnetic tapes used on a HP system can be labeled or unlabeled. A labeled tape
contains standard ANSI, IBM, BACKUP, or TMF tape labels that identify files and tape
volumes and control access. Any tape that has none of these tape labels is an
unlabeled tape; it is up to the application to interpret any file or volume header
information or to work without this information.
Labeled tape support provides a mechanism for accessing tapes produced by other
vendors and a way to create tapes on a system to be read by another vendors
system. In addition, labeled tapes provide a convenient way for applications on HP
systems to maintain databases on magnetic tape.
This section discusses the programmatic interface with magnetic tapes, describing the
following topics in this order:
Basic magnetic tape operations that are mostly common to labeled and unlabeled
tapes. These operations include how to position the tape by record or file, how to
read and write tape records, how to block records for efficiency, and how to further
improve performance by using buffered mode.
Operations specific to labeled tapes, including how to open a labeled tape file and
how to set the attributes for a file using DEFINEs. Examples are included on how
to set attributes for reading and writing single-file labeled tapes, multiple-file
labeled tapes, and files that occupy multiple labeled tapes.
A complete sample program to maintain data on labeled tape.
Operations specific to unlabeled tapes. These include how to open an unlabeled
tape file as well as some guidelines on how to access single-file unlabeled tapes,
multiple-file unlabeled tapes, and files contained on more than one unlabeled tape.
How to terminate access to a labeled or unlabeled tape file.
How to deal with errors returned by magnetic tape read and write operations.
A complete sample program showing the use of many of the features described in
this section for writing or accessing data on an unlabeled tape.
You use DEFINEs to specify attributes for labeled tapes, although DEFINEs can also
be used for unlabeled tapes. This section contains some specific examples. For a
general discussion of the programmatic interface to DEFINEs, refer to Section 7, Using
DEFINEs. For a discussion of DEFINEs at the TACL level, refer to the Guardian
User’s Guide.