Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 52
Accessing a Labeled Tape File: An Example
LOGICAL^BUFFER^3[0] ':=' SBUFFER[1024] FOR 512;
LOGICAL^BUFFER^4[0] ':=' SBUFFER[1536] FOR 512;
.
.
Accessing a Labeled Tape File: An Example
In this subsection, the program used in Section 5, Communicating With Disk Files, for
saving a daily log in an entry-sequenced disk file is modified. Now, because of the
sequential nature of the application, this example will be used to show communication
with magnetic tape.
This example uses a labeled tape file. The program itself works with standard ANSI
labels or standard IBM labels, so long as the label type specified in the DEFINE
matches the label type on the tape.
Preparing the Tape
Before running the program, the tape must have been prepared with appropriate tape
labels. A user with super-group user privilege must apply the labels to the tape using
the ADD TAPELABEL command of the MEDIACOM utility or the LABEL command of
the TAPECOM utility. For example, using the MEDIACOM utility:
1> MEDIACOM
MEDIACOM - T6028D20 (01JUN93)
Copyright Tandem Computers Incorporated 1993
MC>add tapelabel myvol,tapedrive $tape,unload off,override on
TAPE VOLUME MYVOL INITIALIZED
MC>exit
Using the TAPECOM utility:
1> TAPECOM
TAPECOM - T6985D00 (12DEC91) GUARDIAN 90
Copyright Tandem Computers Incorporated 1985-91
?label myvol, device $tape, nounload
STATUS 2501 - VOLUME MYVOL INITIALIZED
?exit
Refer to the DSM/TC Operator Interface (MEDIACOM) for details on the MEDIACOM
utility; refer to the Guardian Disk and Tape Utilities Reference Manual for details on the
TAPECOM utility.
Creating the DEFINE
The example given below uses a record-block size of 2048 bytes and a record size of
512 bytes. Each DEFINE that accesses the file has its BLOCKLEN attribute set to
2048, its RECLEN attribute set to 512, and its RECFORM attribute set to “F.” In
addition, the VOLUME and FILEID attributes must match those on the tape, and the