Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 24
Accessing Labeled Tapes
Specifying Volume and File
You do not need to specify the name of the tape device when accessing labeled tape.
Instead, you identify the file you want by specifying the name of the tape volume and
the name of the file on that volume. The tape can therefore be mounted on any device
and the system will find it. If the tape is mounted on a tape drive on a remote system
in the network, you also need to specify the system name in the SYSTEM attribute.
You specify the volume name using the VOLUME DEFINE attribute. (The VOLUME
attribute is optional when the USE attribute is set to “OUT.”) An example follows:
ATTRIBUTE^NAME ':=' "VOLUME "; !16 bytes
VALUE ':=' "XT55" -> @S^PTR;
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
VALUE,
@S^PTR '-' @VALUE,
DEFAULT^NAMES);
IF ERROR > 0 THEN ...
This call to DEFINESETATTR sets the volume name to “XT55.” This call identifies the
tape spool containing the file you want to access. The volume name is embedded in
the volume label written at the beginning of the tape.
Now use the FILEID attribute to identify the file within volume XT55. If you are reading
or appending to an existing file, then the FILEID must exactly match the FILEID given
to the file when the file was created. If you are creating a new file, you can use any
FILEID that is unique on the tape volume.
The following example shows how to set the FILEID value:
ATTRIBUTE^NAME ':=' "FILEID "; !16 bytes
VALUE ':=' "FILE1" -> @S^PTR;
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
VALUE,
@S^PTR '-' @VALUE,
DEFAULT^NAMES);
IF ERROR > 0 THEN ...
If you are accessing a volume that contains more than one file, you also need to
specify the file sequence number. Use the FILESEQ DEFINE attribute as follows:
ATTRIBUTE^NAME ':=' "FILESEQ "; !16 bytes
VALUE ':=' "1";
LENGTH := 1;
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
VALUE,
LENGTH,
DEFAULT^NAMES);
IF ERROR > 0 THEN ...