Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 23
Accessing Labeled Tapes
Specifying the DEFINE CLASS
Before setting any other DEFINE attributes for magnetic tape, you must first set the
DEFINE class to “TAPE.” Doing so sets the default attributes in the working set to the
default values for tape. You set the DEFINE class using the DEFINESETATTR
procedure as follows:
ATTRIBUTE^NAME ':=' "CLASS "; !16 bytes
VALUE ':=' "TAPE" -> @S^PTR;
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
VALUE,
@S^PTR '-' @VALUE,
DEFAULT^NAMES);
IF ERROR > 0 THEN ...
Remember from Section 7, Using DEFINEs, that we recommend supplying the current
default values for volume and subvolume to every call to DEFINESETATTR. Some
attributes need these values; others do not. However, supplying these values never
does any harm.
Specifying the Label Type
A labeled tape DEFINE must have the LABELS attribute set to ANSI, IBM, or BYPASS.
(The BACKUP and IBMBACKUP attributes are reserved for use by the BACKUP and
RESTORE utilities.) You can set this attribute programmatically using the
DEFINESETATTR procedure. You must set this attribute to the same value as in the
tape label for your program to access the tape. The $ZSVR process displays a
message prompting for an appropriate tape volume. Your program will wait until an
appropriate tape is mounted before proceeding.
An example follows:
ATTRIBUTE^NAME ':=' "LABELS "; !16 bytes
VALUE ':=' "ANSI" -> @S^PTR;
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
VALUE,
@S^PTR '-' @VALUE,
DEFAULT^NAMES);
IF ERROR > 0 THEN ...
This call sets the label type to “ANSI,” identifying the tape as containing standard ANSI
labels.