Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 39
Writing to a File on Multiple Labeled Tape Volumes
appending to a file, this value must also equal the corresponding value in the
file label on the tape.
The tape density (DENSITY attribute). This value must be the same as the
density of existing data on the tape to ensure that the new data gets written to
tape at the same density as data already on the tape. Unlike when reading,
when you write to a magnetic tape, the density is not automatically set to the
density of data already on the tape.
3. Create the DEFINE using the DEFINEADD procedure.
The following example creates a DEFINE called =MY^TAPE^UPDATE. When writing
to the file described by this DEFINE, the system prompts the user to mount a new tape
when the end of a tape is reached. This is done transparently to the application
program. The tape uses standard ANSI labels.
!Turn on DEFINE mode:
NEW^VALUE := 1;
ERROR := DEFINEMODE(NEW^VALUE,
OLD^VALUE);
IF ERROR > 0 THEN ...
!Set the CLASS attribute to TAPE:
ATTRIBUTE^NAME ':=' "CLASS ";
ATTRIBUTE^VALUE ':=' "TAPE" -> @S^PTR;
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
ATTRIBUTE^VALUE,
@S^PTR '-' @ATTRIBUTE^VALUE,
DEFAULT^NAMES);
IF ERROR <> 0 THEN ...
!Set the LABELS attribute to ANSI:
ATTRIBUTE^NAME ':=' "LABELS ";
ATTRIBUTE^VALUE ':=' "ANSI" -> @S^PTR;
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
ATTRIBUTE^VALUE,
@S^PTR '-' @ATTRIBUTE^VALUE,
DEFAULT^NAMES);
IF ERROR <> 0 THEN ...
!Set the VOLUME attribute to MYVOL:
ATTRIBUTE^NAME ':=' "VOLUME ";
ATTRIBUTE^VALUE ':=' "MYVOL" -> @S^PTR;
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
ATTRIBUTE^VALUE,
@S^PTR '-' @ATTRIBUTE^VALUE,
DEFAULT^NAMES);
IF ERROR <> 0 THEN ...
!Set the FILEID attribute to 1_TAPEFILE:
ATTRIBUTE^NAME ':=' "FILEID ";
ATTRIBUTE^VALUE ':=' "1_TAPEFILE" -> @S^PTR;
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
ATTRIBUTE^VALUE,
@S^PTR '-' @ATTRIBUTE^VALUE,