Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 42
Reading From the Only File on a
Labeled Tape Volume
.
.
Reading From the Only File on a Labeled Tape Volume
Like writing, reading from the only file on a labeled tape volume requires a DEFINE
that accurately describes the file and the operation you intend to perform on the file.
Then you read from the file identified by the created DEFINE.
A DEFINE for reading differs from a DEFINE made for writing. You must set the USE
attribute to “IN.” If the tape is an IBM file, you need to set the EBCDIC attribute to “IN.”
Also, you must specify the VOLUME attribute. (The VOLUME attribute is optional
when the USE attribute is set to “OUT.”)
Note that when reading from a tape, it is not necessary to specify the tape density.
The tape controller can determine the correct density.
Just as with writing to the file, you create the DEFINE once and then use it whenever
you want to read from the file.
The following paragraphs describe how to create a DEFINE for this type of tape access
and how to read from the file once the DEFINE exists.
Creating the DEFINE
Create the DEFINE as follows:
1. Turn on DEFINEs by calling the DEFINEMODE procedure.
2. Create a working set for the DEFINE using successive calls to the
DEFINESETATTR procedure. The working set should include the following:
The class of DEFINE (CLASS attribute). Set this value to “TAPE.”
The type of labels used (LABELS attribute). Set this value to “ANSI” or “IBM.”
The volume identifier (VOLUME attribute). Set this value to the value written to
the tape in the volume label.
The file identifier (FILEID attribute). Set this value to the value written to the
tape in the file label.
The file sequence number (FILESEQ attribute). This value must be set to 1 (or
not specified, as the default is 1) because it is the first file on the tape.
The I/O operation (USE attribute). This value must be set to “IN” to read
records from the file.
The conversion mode (EBCDIC attribute). Set this value to “IN” to convert
EBCDIC code to ASCII on input. Use this option only if the tape uses IBM
standard labels.
3. Create the DEFINE using the DEFINEADD procedure.