Technical data
Using Files and Directories
10.7 Accessing Tape Files
In this example, the DIRECTORY command instructs the system to search
for files with both standard names and OpenVMS extended names that do not
have a file type.
10.7.4 Reading Files on Tape Volumes
When you access a tape file for a read operation, the tape is positioned at the
beginning of the file section after the file header labels. When you access a file
residing on a tape volume only to read the attributes in the header labels (rather
than the data in the file section), the tape file system returns the RMS attributes
to your process. For example, when you specify the DIRECTORY/FULL command
for a volume, file, or list of files, the tape file system performs the following tasks:
1. Selects the file identifiers from the header labels
2. Returns the file attributes to your process
3. Positions the tape after the header labels of the last file accessed
A tape file opened for read access is closed in either of the following ways:
Method Description
Implicitly The file is closed implicitly when the drive encounters a tape mark
while the system reads a file. The tape file system then reads the
trailer labels, closes the file, and positions the tape at the next file.
Explicitly The file is closed explicitly when you finish accessing the file before all
the data in the file is read. The tape file system then closes the file
without reading the trailer labels, and the tape remains at the current
position.
Example
Use the DCL command TYPE to read a file or group of files on the tape volume
and to display the contents of the file on your terminal. For example, if you want
to read the contents of a file named TESTFILE.DOC;1 (which you know from
your directory searches is an OpenVMS file residing on the tape volume MTA1:),
enter the following command:
$ TYPE MTA1:TEST*.%*;*
You then receive the following display on your terminal:
MTA1:TESTFILE.DOC;1
This is a test file.
10.7.5 Writing Files to Tape Volumes
When you write files to a tape volume, the tape file system performs access
checks, writes labels, and, if necessary, switches volumes.
10.7.5.1 Writing New Files That Overwrite Existing Files
If a new file will overwrite an existing file, the tape file system performs the
following tasks:
1. Checks the expiration date and accessibility fields of the existing file.
2. If overwriting is allowed, the tape file system performs the following task:
a. Overwrites the header label set of the existing file
b. Creates the file section
10–26 Using Files and Directories










