Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 71
Accessing Unlabeled Tapes
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
ATTRIBUTE^VALUE,
@S^PTR '-' @ATTRIBUTE^VALUE,
DEFAULT^NAMES);
IF ERROR <> 0 THEN ...
!Set the DEVICE attribute to \SYS2.$TAPE1:
ATTRIBUTE^NAME ':=' "DEVICE ";
ATTRIBUTE^VALUE ':=' "\SYS2.$TAPE1" -> @S^PTR;
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
ATTRIBUTE^VALUE,
@S^PTR '-' @ATTRIBUTE^VALUE,
DEFAULT^NAMES);
IF ERROR <> 0 THEN ...
!Create the DEFINE:
DEFINE^NAME ':=' "=TAPE1 ";
ERROR := DEFINEADD(DEFINE^NAME);
IF ERROR <> 0 THEN ...
To open the tape file, pass the DEFINE name to the FILE_OPEN_ procedure:
FILE^NAME ':=' "=TAPE1" -> @S^PTR;
ERROR := FILE_OPEN_(FILE^NAME:@S^PTR '-' @FILE^NAME,
TAPE^NUM);
IF ERROR <> 0 THEN ...
If you open the tape drive without a DEFINE, then you simply pass the name or device
number of the tape drive to the FILE_OPEN_ call:
FILE^NAME ':=' "\SYS2.TAPE" -> @S^PTR;
ERROR := FILE_OPEN_(FILE^NAME:@S^PTR '-' @FILE^NAME,
FILE^NUM);
IF ERROR <> 0 THEN ...
Once the tape drive is open, consider the following before performing read/write
operations to the tape:
Should records be blocked for efficiency?
If writing to the tape, what should the tape density be?
What is the device mode and speed?
Is code conversion necessary?
Do you intend to use buffered mode?
The following paragraphs discuss the above considerations.
Note. The only DEFINE attributes that are allowed for unlabeled tape access are DENSITY,
DEVICE, LABELS, and MOUNTMSG. The following attributes are invalid for unlabeled tapes:
BLOCKLEN, EBCDIC, EXPIRATION, FILEID, FILESECT, FILESEQ, GEN, OWNER,
RECFORM, RECLEN, REELS, RETENTION, SYSTEM, USE, VERSION, VOLUME.