[Digital logo]
[HR]

OpenVMS System Manager's Manual


Previous | Contents

When you specify a file name for a file residing on tape, the tape file system does the following:

  1. Compares the file name with the file header labels of each file until it finds a match in the file identifier field of the file header labels.
  2. The system selects the first file on the magnetic tape whose file name in the file identifier field matches the specified file name.
    The operating system supports neither the directory nor the latest version number concept for magnetic tape volumes. The system does not search for or list the latest version of a specified file. The magnetic tape file system cannot increment version numbers of files written to tape; therefore, two or more files in the same volume set can have the same file name and version number.
    Because the tape file system selects the first matching file name and version number (if specified), the position of the magnetic tape within the volume set determines which file is returned on a search operation. A search operation begins at the current position, so you might want to rewind the volume set before accessing a file.
  3. The search for a matching file and version number (if specified) continues at the beginning of the header-label set of the next file. The search ends when the magnetic tape is positioned at the file where the search began.
    If the system does not find the requested file on the current volume, it searches the remaining volumes in the volume set sequentially and then searches from the beginning of the first volume of the volume set. If the system still does not find the file name, it reports an error.

    9.5.3 Using Wildcard Characters with Tape Volumes

    The OpenVMS operating system supports a limited use of wildcard characters in file specifications for tape volumes.

    Table 9-6 explains the use of wildcard characters with OpenVMS extended names and with standard names.

    Table 9-6 Wildcard Character Support with Tape Volumes
    Wildcard Character OpenVMS Extended Names Standard Names Description
    Asterisk (*) X X In OpenVMS extended names, you can use an asterisk anywhere in the file name and file type field to match a field or portion of a field. You can also use the asterisk in the version number field.

    In standard names, you can use only a single asterisk in a field.

    Percent sign (%) X In OpenVMS extended names, you can use a percent sign in a file specification only to match character positions within a field. You cannot use the percent sign in the version number field.

    Unlike OpenVMS extended names, which can consist of up to 39 characters each for the file name and file type, standard names can have a maximum of 17 characters.

    The following examples show how to use wildcard characters in file specifications to search for files on tape volumes. These examples also show how you can use the DIRECTORY command with tapes. Note that the DIRECTORY command does not work the same with tape files as with disk files.

    Examples

    1. $ DIRECTORY MFA1:*.*;*
      

      This command instructs the system to search a volume set. Because asterisks are used in the file specification and the asterisk is a valid wildcard character for both standard and OpenVMS extended names, the system returns both OpenVMS extended names and standard names. Note that the system returns tape file names within quotation marks.
    2. $ DIRECTORY MTA1:%*.*;*
      $ DIRECTORY MTA0:*.%*;*
      

      In these two commands, the search can match only with OpenVMS extended names because the percent sign is not valid for standard names. In the second command, the file type field must contain at least one character. Files with no file type are not returned.
    3. $ DIRECTORY MTA0:*.;*
      

      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.

    9.5.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 does the following:

    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. 
    

    9.5.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.

    9.5.5.1 Writing New Files That Overwrite Existing Files

    If a new file will overwrite an existing file, the tape file system does the following:

    1. Checks the expiration date and accessibility fields of the existing file.
    2. If overwriting is allowed, the tape file system does the following:
      1. Overwrites the header label set of the existing file
      2. Creates the file section
      3. Writes the trailer labels
      4. Writes two tape marks to denote the logical end-of-volume (EOV)

    All files following the newly created file are lost.

    To close a tape file that was opened for write access, the tape file system issues commands to the driver to write the labels, followed by a double tape mark that indicates the logical EOV.

    9.5.5.2 Appending or Updating Files

    When you use DCL to access an existing file for a write operation, either an append or an update operation is actually performed. Following is a description of each operation.
    Access Method Description
    Append When you access a file for an append operation, the tape is positioned before the tape mark that precedes the trailer labels. After the file is appended and closed, all files beyond the appended file are lost. When the positioning is complete, the processing is handled as if the file had been created.
    Update When you access a file for an update operation, the tape is positioned after the tape mark that follows the header labels. After the file is written to and closed, all files beyond the updated file are lost. The processing is handled as if the file had been created.

    Note that you can update or append tape files only when the header label contains a value of 0 for the buffer offset length. For more information on how to update and append tape files, see Section 9.6.

    If you do not specify the /OVERRIDE=EXPIRATION qualifier when you update a file, the tape file system checks the expiration date field on the file before it allows you to write to that file.

    In addition, before you append a file, the tape file system checks the expiration dates of both the file being appended and the file immediately following. If the expiration date of either file has not been reached, the magnetic tape file system does not allow you to append the file.

    Example

    You can use the CREATE command to access a volume for a write operation. The following CREATE command writes a new file to the tape volume:

    $ CREATE MTA0:MYFILE
    

    After issuing a command like the one in this example, follow these steps:

    1. Enter the contents of the file.
    2. Press Ctrl/Z to close the file and write it to the tape volume without leaving the DCL command level.

    9.6 Copying and Transferring Files

    With the OpenVMS operating system, you can copy files on disks and tapes both within the system and across other operating systems. The OpenVMS operating system provides a number of facilities to assist you in both types of information transfer.

    Table 9-7 summarizes the methods you can use to transfer information.

    Table 9-7 Methods of Transferring Information
    Method Description
    DCL command COPY Most frequently used method for transferring information.
    Convert utility (CONVERT) On a local system, allows you to change the organization of a file from sequential to indexed, for example.
    Exchange utility (EXCHANGE) On a local system, allows you to access disk and tape volumes that are formatted for operating systems other than OpenVMS. You can use EXCHANGE to transfer files between foreign volumes and standard Files--11 volumes.
    DCL command EXCHANGE/NETWORK Allows you to transfer files via the network between OpenVMS and other operating systems. The command is useful for transferring files between nodes that use OpenVMS and those that do not. The file is copied in such a way that it is meaningful on OpenVMS and other operating systems as well.
    Backup utility (BACKUP) With tapes, the only means of copying entire directory trees or files that are not sequentially structured. See Section 10.13.2 for information on using BACKUP to copy files.

    The COPY command, the Exchange utility, and the DCL command EXCHANGE/NETWORK are explained in the following sections.

    In many cases, you can copy information without physically transporting media. Perhaps you want to copy files between systems that are not connected by a communications link. If so, you must be able to move your files physically from one location to another. A convenient way is to copy your files to a portable volume, such as a tape reel, tape cartridge, or disk pack, and then carry that volume to the location of the other system.

    The following sections describe how to perform these tasks:
    Task Section
    Copy files to disk volumes Section 9.6.1
    Copy files to tape volumes Section 9.6.2
    Continue to copy at the end of a tape Section 9.6.3
    Use the Exchange utility to copy files Section 9.6.4
    Use the DCL command EXCHANGE/NETWORK to transfer files over a network Section 9.6.5

    9.6.1 Copying Files to Disk Volumes

    Before you can copy files to a disk volume, you must do the following:

    1. Prepare the volume, as explained in Section 8.3.
    2. Because disks are random-access devices, and because files must be listed in directories, you must create a directory to contain your files on the disk volume after you initialize the volume.

    Copying from Disks

    The default format for files on disk volumes is Files--11 Structure Level 2. You can also initialize disks in the Files--11 Structure Level 1 format, which is the format used by other Digital operating systems, including RSX--11M, RSX--11M-PLUS, RSX--11D, and IAS.

    When you copy files from disks to standard-labeled disk volumes, the following items are not preserved:

    You can use the COPY command to copy the highest version of all the files in your default directory to another directory on that volume.

    Copying from Tapes

    The default format for files on tapes is the standard-labeled volume. The OpenVMS system supports sequential, relative, and indexed files on disks, but you can copy only sequential files to standard-labeled disk volumes. The only valid record formats are variable-length and fixed-length.

    When you copy files with tape file names from magnetic tape to disk, specify a standard OpenVMS file name for the output file name specification. If you do not specify an OpenVMS file name on output, your process receives the following error message:

    RMS-F-FNM, error in file name
    

    This message indicates that the tape file name is not a valid OpenVMS file name.

    If you enter the COPY command with the /LOG qualifier, the system sends a message to the current SYS$OUTPUT device after each file has been copied. To verify that the files were successfully copied, use the DIRECTORY command.

    Examples

    1. CREATE/DIRECTORY DMA3:[PUBS]
      $ DEFINE P DMA3:[PUBS]
      $ COPY *.* P
      $ COPY [PRIMER]*.* P
      $ COPY [COMMANDS]*.* P
      

      The CREATE/DIRECTORY command in this example creates a disk directory file named [PUBS] on DMA3:, and the DEFINE command defines the logical name P as DMA3:[PUBS]. The COPY command copies the highest version of each file in the current default directory and in the directories [PRIMER] and [COMMANDS] to the newly created directory.
    2. $ COPY *.* DMA5:[PRIVATE]
      

      For this example, assume that the disk device DMA5: has been allocated to your process and that a disk volume has been initialized and mounted on that device. Also assume that you have a directory called PRIVATE already created on that volume.
    3. $ COPY/LOG MTA1:"%&*?!SKI! """ SEASON.DAT
      %COPY-S-COPIED, MTA1:[]"%&*?!SKI! """.;1 
      copied to WRKD:[MANUAL]SEASON.DAT;1 (120 records)
      

      The COPY/LOG command in this example copies the tape file %&*?!SKI!#" (# means space) to the file SEASON.DAT on the default disk and directory, WRKD:[MANUAL]. To copy the file to disk, you must specify a new file name. (The OpenVMS software provides defaults for segments of the file specification that are not specified.)
      Because this example uses the /LOG qualifier, the system returns a message that confirms the file was copied from the MTA1: tape volume; the message also tells how many records were copied.
    4. $ COPY/LOG MTA0:*.* *
      %COPY-S-COPIED, MTA0:[]TASTETEST.DAT;1 
      copied to WRKD:[FOOD]TASTETEST.DAT;1 (249 records)
      %COPY-S-COPIED, MTA0:[]ALLAT;1 copied to WRKD:[FOOD]ALALL;1 (48 records)
      %COPY-S-NEWFILES, 2 files created
      

      In this example, the COPY/LOG command specifies wildcard characters for the file name and file type. Therefore, the system copies the only two files on the tape volume to the disk volume.
    5. $ COPY/LOG MTA1:*.* [EX]
      %COPY-S-COPIED, MTA1:[].DAT;1 copied to WRKD:[EX]TEST.DAT21 records
      %COPY-E-OPENOUT, error opening WRKD:[EX]"%&*()!SKI! """.;1 as output
      -RMS-F-FNM, error in file name
      %COPY-W-NOTCOPIED, MTA1:[]"%&*()!SKI! """.;1 not copied
      %COPY-E-OPENOUT, error opening WRKD:[EX]"SANFRAN%%%""".;1 as output
      -RMS-F-FNM, error in file name
      %COPY-W-NOTCOPIED, MTA1:[]"SANFRAN%%%""".;1 not copied
      %COPY-S-COPIED, MTA1:[]OPENVMS_LONG$FILE_NAME.LONG_EXT;1 
      copied to WRKD$:[EX]OPENVMS_LONG$FILE_NAME.LONG_EXT;1 (80 records)
      %COPY-S-COPIED, MTA1:[]C6.JOU;1 copied to WRKD:[EX]C6.JOU;1 (4 records)
      %COPY-S-NEWFILES, 2 files created
      

      The COPY/LOG command string specifies that all files on the volume mounted on tape volume MTA1: are to be copied to the current default disk and directory WRKD:[EX]. However, the system does not copy files with tape file names, but, instead, returns an error message.

    9.6.2 Copying Files to Tape Volumes

    You can use the COPY command to copy files from a disk volume to a tape volume. The procedures are similar to those for copying files from one disk volume to another. One difference, however, is that magnetic tapes are sequential-access devices and do not have directories. You must set up (initialize and mount) a tape device before copying disk files to a tape volume. (The characteristics of tape files are described in Section 9.5.)

    The entire set of Files--11 file names is supported for magnetic tapes. You can copy a disk file with the following file name to a magnetic tape volume without having to modify the file name:

       THIS_IS$AN_OPENVMSLONG_FILE.LONG_TYPE 
    

    Note

    Most systems that are not OpenVMS do not use file names longer than 17 characters.

    Although the OpenVMS system supports stream and variable with fixed-length control (VFC) records, it encodes these records in a variable-length format on standard-labeled volumes. Systems that are not OpenVMS do not distinguish stream records or VFC records from variable-length records; instead, they interpret both as variable-length records. Therefore, do not create either stream or VFC records on volumes that will be used for information interchange to a system that is not OpenVMS.

    The following steps show how to use DCL commands to copy files from a default directory on a disk volume to a standard-labeled magnetic tape volume. Included in the steps are examples showing how to allocate, initialize, and use a magnetic tape to copy a set of your disk files.

    How to Perform This Task

    To copy files from a default directory on a disk volume to a standard-labeled tape volume, follow these steps:

    1. First, allocate a drive as follows:
      $ ALLOCATE MT: TAPE_DEVICE
      %DCL-I-ALLOC _MARS$MTA2: allocated
      

      This ALLOCATE command requests the allocation of a tape drive whose name begins with MT. The logical name TAPE_DEVICE in this case refers to the MARS$MTA2: drive.
      The system response indicates that unit 2 on controller A was available and is now allocated to you. You can now physically load the tape on the drive. Be sure the write ring on the tape is in place; if it is not, you cannot write to the tape.
    2. Initialize the tape by entering a command like the following:
      $ INITIALIZE TAPE_DEVICE: GMB001/PROTECTION=(GROUP:R,WORLD)
      

      The INITIALIZE command specifies the logical name for the volume (TAPE_DEVICE, which in this case refers to MTA2:) and the volume label for the tape volume (GMB001). The label can be no longer than six characters. The /PROTECTION qualifier defines a protection code restricting group access to read and allowing no world access.
    3. Enter the MOUNT command to mount the volume and write files to it, as in the following example:
      $ MOUNT TAPE_DEVICE: GMB001
      %MOUNT-I-MOUNTED, GMB001 mounted on _MTA2:
      $ COPY *.* TAPE_DEVICE:
      

      The MOUNT command specifies the device name and volume label of the volume on the device. The COPY command copies the highest version of each file in your default directory onto the tape. The file names, file types, and version numbers of the output files default to the same file names, file types, and version numbers as the input files.
      If you enter the COPY command with the /LOG qualifier, the system sends a message to the current SYS$OUTPUT device after it copies each file.
    4. You can also use the DIRECTORY command to verify that the files were copied successfully.
      $ DIRECTORY TAPE_DEVICE:
      

      This DIRECTORY command lists the file names and file types of all files on the tape.
    5. When you finish using the magnetic tape, dismount and deallocate it as follows:
      $ DISMOUNT TAPE_DEVICE:
      $ DEALLOCATE TAPE_DEVICE:
      

      If you do not dismount and deallocate the magnetic tape, the system does so automatically when you log out.

    The following examples illustrate ways of copying files to tape volumes.

    Examples

    1. $ COPY *.* MTA2:
      

      For this example, assume that MTA2: has been allocated to your process and that a tape volume has been initialized and mounted on that device. The COPY command writes files to the MTA2: tape volume.
      The highest versions of all files in your default disk directory are copied to the tape volume. The file names, file types, and version numbers of the output files default to the same file names, file types, and version numbers as the input files.
    2. $ COPY/LOG FORTAP.DAT MTA1:"%&*?!SKI! "" "
      %COPY-S-COPIED, WRKD:[MANUAL]FORTAP.DAT;1 
      copied to MTA1:[]"%&*?!SKI! """.;0 (120 records)
      

      In this command for copying from disk to tape, a tape file name is specified as the output file specification. Note that the trailing space in the file name %&*?!SKI!#"# (where # means space) is not present because trailing spaces are not significant in tape names.
    3. $ COPY/LOG OPENVMS_LONG$FILE_NAME.LONG_EXT MTA1:
      %COPY-S-COPIED, WRKD:[MANUAL]OPENVMS_LONG$FILE_NAME_EXT;1 
      copied to MTA1:OPENVMS_LONG$FILE_NAME.LONG_EXT;1 (80 records)
      

      In this example, a long file name with a long file type is copied to the tape volume MTA1: with the same file name and type as on the disk volume.
    4. $ COPY/LOG %%.JOU;* MTA1:*.*
      %COPY-S-COPIED, WRKD:[MANUAL]C6.JOU;1 copied to MTA1:[]C6.JOU;1 (4 records)
      

      In this example, all files with a two-character file name and a file type of .JOU are copied to the tape volume MTA1: with the same file name and type as on the disk volume. Version numbers are preserved.

    9.6.3 Continuing to Copy at the End of a Tape

    When you are copying to or from a tape and that tape reaches the end, the system suspends processing and sends a request to mount the next tape in the volume set. An operator communication manager (OPCOM) message similar to the following is displayed at the terminal:
    %%%%%%%%%%%  OPCOM, 14-MAY-1996 15:23:31.78  %%%%%%%%%%%
    request 3, from user PLAW
    MOUNT new relative volume 2 (DW0QT2) on MTA1:
    

    Note

    Because messages are sent only to the operator's terminal that is enabled for tape messages, you do not usually see this message and might not realize that another tape is needed to complete the read or write operation.

    See Section 18.6 for more information on OPCOM messages.

    If automatic volume switching is disabled or if the tape file system cannot mount a given volume, you might need to mount a continuation volume in a volume set. See Section 8.8.2 for information on mounting continuation volumes.

    9.6.4 Using the Exchange Utility (EXCHANGE)

    The Exchange utility (EXCHANGE) converts the format of files, as appropriate, when copying files between volumes of different structures. EXCHANGE recognizes all Files-11 and RT-11 disk volumes on OpenVMS devices, as well as all DOS-11 and RT-11 formatted volumes on 9-track tape devices.

    For more information on how to use EXCHANGE and for a description of all EXCHANGE commands, qualifiers, and parameters, see online help or the archived manual OpenVMS Exchange Utility Manual.

    9.6.5 Using the EXCHANGE/NETWORK Command

    Use the DCL command EXCHANGE/NETWORK to transfer files to and from operating systems that do not support OpenVMS file organizations. This transfer occurs over a DECnet communications link that connects nodes that are both OpenVMS and not OpenVMS operating systems.


    Previous | Next | Contents | [Home] | [Comments] | [Ordering info] | [Help]

    [HR]

      6017P028.HTM
      OSSG Documentation
      22-NOV-1996 14:21:57.35
    

    Copyright © Digital Equipment Corporation 1996. All Rights Reserved.

    Legal