|
|
|
|
Logical and physical I/O functions to magnetic tape devices allow sequential access to volume storage and require only that the requesting process have direct access to the device. The results of logical and physical I/O operations are unpredictable if an ACP is present.
Virtual I/O functions require intervention by an ACP and must be executed in a prescribed order. The normal order is to create and access a file, write information to that file, and deaccess the file. Subsequently, when you access the file, you read the information and then deaccess the file. You can write over the file when the information it contains is no longer useful and the file has expired.
Any number of bytes (from a minimum of 14 to a maximum of 65,535) can be read from or written into a single block by a single request. The number of bytes itself has no effect on the applicable quotas (direct I/O, buffered I/O, and AST). Reading or writing any number of bytes subtracts the same amount from a quota.
The volume to which a logical or virtual function is directed must be mounted for the function actually to be executed. If it is not, either a "device not mounted" or "invalid volume" status is returned in the I/O status block.
Magnetic Tape I/O Functions lists the logical, virtual, and physical magnetic tape I/O functions and their function codes. These functions are described in more detail in the following paragraphs. ACP-QIO Interface describes the QIO level interface to the magnetic tape device ACP. Optional Features for Improving I/O Performance describes features to improve performance for larger file transfers.
Function Code | Arguments | Type1 | Function Modifiers | Function |
---|---|---|---|---|
IO$_ACCESS
|
P1,[P2],[P3], [P4],[P5]
|
V
|
IO$M_CREATE IO$M_ACCESS
|
Search a tape for a specified
file and access the file if found and IO$M_ACCESS is set. If the
file is not found and IO$M_CREATE is set, create a file at end-of-tape (EOT)
marker.
|
IO$_ACPCONTROL
|
P1,[P2],[P3], [P4],
[P5]
|
V
|
IO$M_DMOUNT
|
Perform miscellaneous control
functions. 2
|
IO$_AVAILABLE
|
|
P
|
|
Clear volume valid bit.
|
IO$_CREATE
|
P1,[P2][,[P3], [P4],[P5]
|
V
|
IO$M_CREATE IO$M_ACCESS
|
Create a file.
|
IO$_DEACCESS
|
P1,[P2],[P3], [P4],[P5]
|
V
|
|
Deaccess a file and, if
the file has been written, write out trailer records.
|
IO$_DSE3
|
|
P
|
IO$M_NOWAIT
|
Erase a prescribed section of
the tape.
|
IO$_FLUSH
|
|
L
|
|
Flush the controller cache to
tape.
|
IO$_MODIFY
|
P1,[P2],[P3], [P4],[P5]
|
V
|
|
Write user labels.
|
IO$_PACKACK
|
|
P
|
|
Initialize volume valid
bit.
|
IO$_READLBLK 4
|
P1,P2
|
L
|
IO$M_DATACHECK5 IO$M_INHRETRY IO$M_REVERSE6
|
Read logical block.
|
IO$_READPBLK
|
P1,P2
|
P
|
IO$M_DATACHECK IO$M_INHRETRY
IO$M_REVERSE
|
Read physical block.
|
IO$_READVBLK
|
P1,P2
|
V
|
IO$M_DATACHECK IO$M_INHRETRY
IO$M_REVERSE
|
Read virtual block.
|
IO$_REWIND
|
|
L
|
IO$M_INHRETRY IO$M_NOWAIT IO$M_RETENSION
|
Reposition tape to the beginning-of-tape
(BOT) marker.
|
IO$_REWINDOFF
|
|
L
|
IO$M_INHRETRY IO$M_NOWAIT IO$M_RETENSION
|
Rewind and unload the tape
on the selected drive.
|
IO$_SENSECHAR
|
[P1],[P2]7
|
P
|
IO$M_INHRETRY
|
Sense the tape characteristics
and return them in the I/O status block.
|
IO$_SENSEMODE
|
[P1],[P2]
|
L
|
IO$M_INHRETRY
|
Sense the tape characteristics
and return them in the I/O status block.
|
IO$_SETCHAR
|
P1,[P2]
|
P
|
|
Set tape characteristics
for subsequent operations.
|
IO$_SETMODE
|
P1,[P2]
|
L
|
|
Set tape characteristics
for subsequent operations.
|
IO$_SKIPFILE
|
P1
|
L
|
IO$M_INHRETRY IO$M_NOWAIT8 IO$M_ALLOWFAST
|
Skip past a specified number
of tape marks in either a forward or reverse direction.
|
IO$_SKIPRECORD
|
P1
|
L
|
IO$M_INHRETRY IO$M_NOWAIT
|
Skip past a specified number
of blocks in either a forward or reverse direction.
|
IO$_UNLOAD
|
|
L
|
IO$M_INHRETRY IO$M_NOWAIT
|
Rewind and unload the tape
on the selected drive.
|
IO$_WRITELBLK
|
P1,P2
|
L
|
IO$M_ERASE9 IO$M_DATACHECK
IO$M_INHRETRY
IO$M_INHEXTGAP
10 IO$M_NOWAIT
|
Write logical block.
|
IO$_WRITEOF
|
|
L
|
IO$M_INHRETRY IO$M_INHEXTGAP IO$M_NOWAIT
|
Write an extended interrecord
gap followed by a tape mark.
|
IO$_WRITEPBLK
|
P1,P2
|
P
|
IO$M_ERASE IO$M_DATACHECK
IO$M_INHRETRY
IO$M_INHEXTGAP
IO$M_NOWAIT
|
Write physical block.
|
IO$_WRITEVBLK
|
P1,P2
|
V
|
IO$M_DATACHECK
IO$M_INHRETRY
IO$M_INHEXTGAP
IO$M_NOWAIT
|
Write virtual block.
|
The function-dependent arguments for IO$_CREATE, IO$_ACCESS, IO$_DEACCESS, IO$_MODIFY, IO$_ACPCONTROL are as follows:
See ACP-QIO Interface for more information on these functions.
The function-dependent arguments for IO$_READVBLK, IO$_READLBLK, IO$_READPBLK, IO$_WRITEVBLK, IO$_WRITELBLK, and IO$_WRITEPBLK are as follows:
The function-dependent argument for IO$_SKIPFILE and IO$_SKIPRECORD is:
P1--The number of tape marks to skip over in the case of a skip file operation; or, in the case of a skip record operation, the number of blocks to skip over. If a positive number is specified, the tape moves forward; if a negative number is specified, the tape moves in reverse. (The maximum number of tape marks or records that P1 can specify is 32,767.) |
Defining the P1 Parameter in a IO$_SKIPRECORD QIO shows the correct method of defining the P1 parameter in an IO$_SKIPRECORD QIO.
Read
The read function
reads data into a specified buffer in the forward or reverse direction
starting at the next block position.
The operating system provides the following read function codes:
If a read virtual block function is directed to a volume that is mounted foreign, it is converted to a read logical block function. If a read virtual block function is directed to a volume that is mounted structured, the volume is handled the same way as a file-structured device.
Two function-dependent arguments are used with these codes: P1 and P2. These arguments are described in Magnetic Tape Function Codes.
If the read function code includes the reverse function modifier (IO$M_REVERSE), the drive reads the tape in the reverse direction instead of the forward direction. IO$M_REVERSE cannot be specified for the TUK50 and TQK50 devices.
The data check function modifier (IO$M_DATACHECK) can be used with all read functions. If this modifier is specified, a data check operation is performed after the read operation completes. (The drive performs a space reverse or space forward between the read and data check operations.) A data check operation is also performed if the volume that was read, or the volume on which the file resides (virtual read), has the characteristic "data check all reads." Furthermore, a data check is performed after a virtual read if the file has the attribute "data check on read." The TS04 and TU80 tape drives do not support the data check function.
For read physical block and read logical block functions, the drive returns the status SS$_NORMAL (not end-of-tape status) if either of the following conditions occurs and no other error condition exists:
The transferred byte count reflects the actual number of bytes read.
If the drive reads a tape mark during a logical or physical read operation in either the forward or reverse direction, any of the following conditions can return an end-of-file (EOF) status:
An EOF status is also returned if the drive attempts a read operation in the reverse direction when the tape is positioned at the beginning-of-tape (BOT) marker. All conditions that cause an EOF status result in a transferred byte count of zero.
If the drive attempts to read a block that is larger than the specified memory buffer during a logical or physical read operation, a data overrun status is returned. The buffer receives only the first part of the block. On a read in the reverse direction (on drives other than the TK50 and TZ30) the buffer receives only the latter part of the block. The transferred byte count is equal to the actual size of the block. Read reverse starts at the top of the buffer. Therefore, the start of the block is at P1 plus P2 minus the length read. The TUK50 and TZ30 cannot actually perform read reverse operations; they must be simulated by the driver. Therefore, the data returned are those that would have been returned had the block been read in the forward direction.
It is not possible to read a block that is less than 14 bytes in length. Records that contain less than 14 bytes are termed "noise blocks" and are completely ignored by the driver.
Write
The write function writes data from a specified buffer to
tape in the forward direction starting at the next block position.
The operating system provides the following write function codes:
If a write virtual block function is directed to a volume that is mounted foreign, the function is converted to a write logical block. If a write virtual block function is directed to a volume that is mounted structured, the volume is handled the same way as a file-structured device.
Two function-dependent arguments are used with these codes: P1 and P2. These arguments are described in Magnetic Tape Function Codes.
The IO$M_ERASE function modifier can be used with the IO$_WRITELBLK and IO$_WRITEPBLK function codes to erase a user-selected part of a tape. This modifier propagates an erase pattern of all zeros from the current tape position to 10 feet past the EOT position and then rewinds to the BOT marker.
The data check function modifier (IO$M_DATACHECK) can be used with all write functions. If this modifier is specified, a data check operation is performed after the write operation completes. (The drive performs a space reverse between the write and the data check operations.) The driver forces a data check operation when an error occurs during a write operation. This ensures that the data can be reread. A data check operation is also performed if the volume written, or the volume on which the file resides (virtual write), has the characteristic "data check all writes." Furthermore, a data check is performed after a virtual write if the file has the attribute "data check on write." The TS04 and TU80 tape drives do not support the data check function.
If the IO$M_NOWAIT function modifier is specified, write-back caching is enabled on a per-command basis. IO$M_NOWAIT is applicable only to TU81-Plus drives.
If the drive performs a write physical block or a write logical block operation, an EOT status is returned if either of the following conditions occurs and no other error condition exists:
The transferred byte count reflects the size of the block written. It is not possible to write a block less than 14 bytes in length. An attempt to do so results in the return of a bad parameter status for the QIO request.
Rewind
The rewind function
repositions the tape to the beginning-of-tape (BOT) marker.
If the IO$M_NOWAIT function modifier is specified, the I/O operation is completed when the rewind is initiated. Otherwise, I/O completion does not occur until the tape is positioned at the BOT marker.
If the IO$M_RETENSION function modifier is specified and the device supports the retension operation, the rewind function positions the tape to the physical-end-of-tape (EOT) marker and rewinds the tape to the BOT marker. If the tape does not support the IO$M_RETENSION modifer, a SS$_ILLIOFUNC error is returned.
IO$_REWIND has no function-dependent arguments.
Skip File
The skip file function
(IO$_SKIPFILE) skips past a specified number of tape marks in either
a forward or reverse direction. A function-dependent argument (P1)
is provided to specify the number of tape marks to be skipped, as
shown in
IO$_SKIPFILE Argument. If a positive
file count is specified, the tape moves forward; if a negative file count
is specified, the tape moves in reverse. (The actual number of files
skipped is returned as an unsigned number in the I/O status block.)
Figure 1 IO$_SKIPFILE Argument |
Only tape marks (when the tape moves in either direction) and the BOT marker (when the tape moves in reverse) are counted during a skip file operation. The BOT marker terminates a skip file function in the reverse direction. The end-of-tape (EOT) marker does not terminate a skip file function in either the forward or reverse direction. A negative skip file function leaves the tape positioned just before a tape mark (at the end of a file) unless the BOT marker is encountered, whereas a positive skip file function leaves the tape positioned just past the tape mark.
A skip file function in the forward direction can also be terminated if two consecutive tape marks are encountered. Logical End-of-Volume (EOV) Detection describes this feature.
The IO$M_ALLOWFAST modifier can be used with the IO$_SKIPFILE function to provide better performance on SCSI tape drives that support the SCSI space-by-file-marks command and the SCSI read position command.
When the IO$M_ALLOWFAST modifier is specified, a tape operation skips over consecutive tape marks that are not immediately before the end-of-data position on the medium. However, if two consecutive tape marks are detected immediately before the end-of-data position on the tape, the tape is positioned between these two tape marks and the SS$_ENDOFVOLUME status is returned.
The IO$M_ALLOWFAST modifier allows a SCSI tape subsystem to use the optimized IO$_SKIPFILE if it is capabable. If a specific tape device does not adequately support the optimized IO$_SKIPFILE that uses the SCSI space-by-file-marks command, the tape subsystem will use the standard space-by-records algorithm.
Skip Record
The skip record
function skips past a specified number of physical tape blocks in
either a forward or reverse direction. A device- or function-dependent
argument (P1) specifies the number of blocks to skip, as shown in
IO$_SKIPRECORD Argument. If a positive block count
is specified, the tape moves forward; if a negative block count
is specified, the tape moves in reverse. The actual number of blocks
skipped is returned as an unsigned number in the I/O status block.
If a tape mark is detected, the count is the number of blocks skipped,
plus 1 (forward tape motion) or minus 1 (reverse tape motion).
Figure 2 IO$_SKIPRECORD Argument |
A skip record operation is terminated by the end-of-file (EOF) marker when the tape moves in either direction, by the BOT marker when the tape moves in reverse, and by the EOT marker when the tape moves forward.
A skip record function in the forward direction can also be terminated if the tape was originally positioned between two tape marks. Logical End-of-Volume (EOV) Detection describes this feature.
Logical
End-of-Volume (EOV) Detection
A skip file or skip record operation that uses the standard
space-by-records algorithm is terminated when two consecutive tape
marks are encountered when the tape moves in the forward direction.
After the operation terminates, the tape remains positioned between
the two tape marks that were detected. The I/O status block (IOSB)
returns the status SS$_ENDOFVOLUME and the actual number of files
(or records) skipped during the operation prior to the detection
of the second tape mark. The skip count is returned in the high-order word
of the first longword of the IOSB.
An optimized skip file that uses the IO$M_ALLOWFAST modifier is terminated when the end-of-data position is encountered. If two consecutive tape marks immediately precede the end-of-data position on the tape, the tape is positioned between these two tape marks. The SS$_ENDOFVOLUME status and the skip count are returned in the IOSB.
Subsequent skip record (or skip file) requests terminate immediately when the tape is positioned between the two tape marks, producing no net tape movement and returning the SS$_ENDOFVOLUME status with a skip count of zero.
To move the tape beyond the second tape mark, you must employ another I/O function. For example, the IO$_READLBLK function, if issued after receipt of the SS$_ENDOFVOLUME status return, terminates with an SS$_ENDOFFILE status and with the tape positioned just past the second tape mark. From this new position, other skip functions could be issued to produce forward tape motion (assuming there is additional data on the tape).
If three consecutive tape marks are encountered during a skip file function, you must issue two IO$_READLBLK functions, the first to get the SS$_ENDOFFILE return and the second to position the tape past the third tape mark.
Write End-of-File
The write end-of-file
(EOF) function writes an extended interrecord gap (of approximately
3 inches for nonreturn-to-zero-inverted (NRZI) recording and 1.5
inches for phase-encoded (PE) recording) followed by a tape mark.
No device- or function-dependent arguments are used with IO$_WRITEOF.
An end-of-tape (EOT) status is returned in the I/O status block if either of the following conditions is present and no other error conditions occur:
Rewind Offline
The rewind offline function rewinds and unloads the tape on
the selected drive.
The I/O operation is completed as soon as the tape movement is initiated. The actual finish of the mechanical rewind or unload operation may occur long after the I/O operation completes.
If the IO$M_RETENSION function modifier is specified and the device supports the retension operation, the rewind offline function positions the tape to the physical end-of-tape (EOT) marker and rewinds the tape to the beginning-of-tape (BOT) marker. If the tape does not support the IO$M_RETENSION modifer, a SS$_ILLIOFUNC error is returned.
No device- or function-dependent arguments are used with IO$_REWINDOFF.
Unload
The unload function rewinds and unloads the tape on the selected
drive. The unload function is functionally the same as the rewind
offline function. If the IO$M_NOWAIT function modifier is specified,
the I/O operation is completed as soon as the rewind operation is
initiated. No device- or function-dependent arguments are used with
IO$_UNLOAD.
Sense Tape Mode
The sense tape mode
function senses the current device-dependent and extended device
characteristics (see
Device-Dependent Information for Tape Devices and
Extended Device Characteristics for Tape Devices).
The operating system provides the following function codes:
Sense mode requires logical I/O privilege. Sense characteristics requires physical I/O privilege. For TMSCP drives, the sense mode function returns magnetic tape information in a user-supplied buffer, which is specified by the following function-dependent arguments:
If P1 is not zero, the sense mode buffer returns the tape characteristics. (If P2=8, the second longword of the buffer contains the device-dependent characteristics. If P2=12, the second longword contains the device-dependent characteristics and the third longword contains the tape densities that the drive supports and the extended tape characteristics.) The extended characteristics are identical to the information returned by DVI$_DEVDEPEND2 (see Magnetic Tape I/O Functions). Sense Mode P1 Buffer shows the contents of the P1 buffer.
Figure 3 Sense Mode P1 Buffer |
Set Mode
Set mode operations
affect the operation and characteristics of the associated magnetic
tape device. The operating system defines two types of set mode
functions: set mode and set characteristics.
Set mode requires logical I/O privilege. Set characteristics requires physical I/O privilege. The following function codes are provided:
These functions take the following device- or function-dependent arguments (other arguments are ignored):
Set Mode Characteristics Buffer for IO$_SETMODE shows the P1 characteristics buffer for IO$_SETMODE. Set Mode Characteristics Buffer for IO$_SETCHAR shows the same buffer for IO$_SETCHAR.
Figure 4 Set Mode Characteristics Buffer for IO$_SETMODE |
Figure 5 Set Mode Characteristics Buffer for IO$_SETCHAR |
The first longword of the P1 buffer for the set characteristics function contains information on device class and type, and the buffer size. The device class for tapes is DC$_TAPE.
The $DCDEF macro defines the device type and class names. The buffer size is the default to be used for tape transfers (this default is normally 2048 bytes).
The second longword of the P1 buffer for both the set mode and set characteristics functions contains the tape characteristics. Set Mode and Set Characteristics Magnetic Tape Characteristics lists the tape characteristics and their meanings. The $MTDEF macro defines the symbols listed. If P2=12, the third longword contains the extended tape characteristics for TMSCP drives, which are listed in Extended Device Characteristics for Tape Devices. The extended tape characteristics are defined by the $MT2DEF macro and are identical to the information returned by DVI$_DEVDEPEND2.
Characteristic11 | Meaning | |
---|---|---|
MT$M_PARITY
|
If set, all
data transfers are performed with even parity. If clear (normal case),
all data transfers are performed with odd parity. Even parity can be
selected only for nonreturn-to-zero-inverted recording at 800 bits/inch.
Even parity cannot be selected for phase-encoded recording (tape
density is MT$K_PE_1600) or group-coded recording (tape density
is MT$K_GCR_6250) and is ignored.
|
|
MT$V_DENSITY MT$S_DENSITY
|
Specifies the
density at which all data transfers are performed. Tape density
can be set only when the selected drive's tape position is at the BOT
marker. Possible density values are as follows:
|
|
|
MT$K_DEFAULT
|
Default system density.
|
|
MT$K_GCR_6250
|
Group-coded recording, 6250
bits/inch.
|
|
MT$K_PE_1600
|
Phase-encoded recording,
1600 bits/inch.
|
|
MT$K_NRZI_800
|
Nonreturn-to-zero-inverted
recording, 800 bits/inch.
|
|
MT$K_BLK_833
|
Cartridge block mode recording.12
|
MT$V_FORMAT MT$S_FORMAT
|
Specifies the
format in which all data transfers are performed. Possible format
values are as follows:
|
|
|
MT$K_DEFAULT
|
Default system format.
|
|
MT$K_NORMAL11
|
Normal PDP-11 format. Data bytes are recorded
sequentially on tape with each byte occupying exactly one frame.
|
Characteristic13 | Meaning |
---|---|
MT2$V_WBC_ENABLE |
Enable write-back caching on a per-unit basis. |
MT2$V_RDC_DISABLE |
Disable read caching on a per-unit basis. |
Application programs that change specific magnetic tape characteristics should perform the following steps, as shown in Device Characteristic Program Example in Magnetic Tape Drive Programming Examples:
Failure to follow this sequence will result in clearing any previously set characteristic.
Multiple
Tape Density Support (Alpha Only)
As of Version 7.2, OpenVMS Alpha permits the selection of
any density and any compression supported by a tape drive. You can
write to tapes using any density and any compression algorithm supported
by the tape drive. Exchanging tapes among tape drives with different
default settings for density or compression is much easier with
this enhancement.
Mutiple tape density support is provided by changes in the QIO interface. These changes are guided by device/density tables in system libraries and the corresponding class drivers. This enhancement functions with tape drives that support multiple tape density switching via the standard MODE_SENSE and MODE_SELECT mechanisms. All density and compression options available for a given drive will be accessible by the system. The QIO interface uses MT3DEF to identify the drives, and to match them with their density and compression code options. Some newer drives may not be included in the module.
After the media has been initialized to a specific density, it will remain that density until the media is initialized to a different density. For example, if an HP media has been initialized with TK86 density, the DCL command MOUNT/DENSITY=TK85 will have no effect because the media is initialized at TK86 density. Likewise, BACKUP/DENSITY=TK85 will have no effect if the media is initialized at TK86 density. However, BACKUP/DENS=TK85/INITIALIZE will initialize the media to TK85 density. |
Data Security
Erase
The data security erase
function erases all data from the current position of the volume
to 10 feet beyond the EOT reflective strip, and then rewinds the
tape to the BOT marker. It is a physical I/O function and requires the
access privilege necessary to perform physical I/O functions. The
following function code is provided:
IO$_DSE |
If the function is issued when a tape is positioned at the BOT marker, all data on the tape will be erased.
IO$_DSE takes no device- or function-dependent arguments.
Modify
Specifying the ATR$C_USERLABEL or ATR$C_ENDLBLAST attributes
with IO$_MODIFY results in a bad attribute error. If any other attributes
are specified, the IO$_MODIFY function is treated as a no-operation; that
is, the function returns success, but no action is performed.
Pack
Acknowledge
The
pack acknowledge function sets the volume valid bit for all magnetic
tape devices. It is a physical I/O function and requires the access
privilege to perform physical I/O. The following function code is
provided:
IO$_PACKACK |
IO$_PACKACK must be the first function issued when a volume is placed in a magnetic tape drive. IO$_PACKACK is issued automatically when the DCL commands INITIALIZE or MOUNT are issued.
Available
The available function
clears the volume valid bit for all magnetic tape drives, that is,
it reverses the function performed by the pack acknowledge function
(see the
Pack Acknowledge). A
rewind of the tape is performed (applicable to all tape drives).
No unload function is issued to the drive. The following function code
is provided:
IO$_AVAILABLE |
This function takes no function-dependent arguments.
Flush
The flush function is used to ensure that all previously issued
cached commands have fully completed. Normally, hosts use this function
to establish or maintain synchronization with write-back cached
commands issued to the specified tape unit. The I/O request does
not complete until all cached data is written successfully to the
media in the exact order that the user specified.
IO$_FLUSH |
This function code takes no function-dependent arguments.
1 V = virtual; L = logical; P = physical.
2 See ACP Control.
3 Only for TMSCP drives, and TZK50, and TZ30 tape devices.
4 On OpenVMS Alpha, P1 supports a 64-bit address.
5 Not for TS04 and TU80 tape devices.
6 Not for TUK50 and TQK50 tape devices.
7 The P1 and P2 arguments for IO$_SENSEMODE and IO$_SENSECHAR and the P2 argument for IO$_SETMODE and IO$_SETCHAR are for TMSCP drives only.
8 Only for RV20, TA90, and TU81-Plus drives.
9 Takes no arguments; valid only for TMSCP drives, and TZK50 and TZ30 tape devices.
10 Only for TE16, TU45, and TU77 tape devices.
11 Defined by the $MTDEF macro.
12 Only for the TK50 and TZ30.
13 Defined by the $MT2DEF macro. Only for TU81-Plus drives.
( Number takes you back )
|
|