Document revision date: 19 July 1999
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

OpenVMS System Manager's Manual


Previous Contents Index

9.5.3.3.2 Using the SET FILE Command

You can use the DCL command SET FILE to modify the characteristics of one or more files or to assign an additional name, or alias, to a file. The following examples illustrate ways you can use the SET FILE command.

Examples


  1. $ SET FILE/EXPIRATION_DATE=15-APR-1997:11:00 BATCH.COM;3
    

    This SET FILE command requests that the expiration date of the file BATCH.COM;3 be set to 11:00 a.m., April 15, 1997.


  2. $ SET FILE/BEFORE=15-APR-97/ERASE_ON_DELETE PERSONNEL*.SAL
    

    This SET FILE command erases disk locations for files that are deleted with commands such as DELETE or PURGE when applied to all files that match the file specification PERSONNEL*.SAL and are dated before April 15, 1997.


  3. $ SET FILE/OWNER_UIC=[DOCUMENTATION,GRAY]/VERSION_LIMIT=100 MYFILE.DAT
    

    This SET FILE command modifies the characteristics of the file MYFILE.DAT, changing the owner UIC and assigning a file version limit of 100. Note that the /OWNER_UIC qualifier requires SYSPRV or GRPPRV privilege for changing the ownership at the system or group level.


  4. $ SET FILE OLD_FILENAME.DAT/ENTER=NEW_FILENAME.DAT
    

    This SET FILE command assigns an additional name, or alias (NEW_FILENAME.DAT), to the file OLD_FILENAME.DAT. Both the original name and the alias refer to the same file. For this reason, be careful when you delete files with aliases. To keep the file, but to remove one of its names, use the /REMOVE qualifier with the SET FILE command. You cannot use wildcards in the file name. (Refer to the OpenVMS DCL Dictionary for details.)

9.5.4 Protecting Disk Directories

Each directory has a protection associated with it. Directory protection can override the protection of individual files within the directory. For example, if a directory denies world access, world users cannot look up files in that directory even though the files permit world access.

For directory protection, you can use the access types shown in Table 9-4.

Table 9-4 Access Types for Directory Protection
Access Type Gives you the right to...
Read Examine, print, or copy a file. If you have read access to a directory, you can display the contents of the directory with the DIRECTORY command. For example, if you have read access to the directory [JONES], you can enter the following command:
$ DIRECTORY [JONES]

This command displays the files contained in the [JONES] directory.

With read access, you can access any file listed in the directory, unless the protection on that file denies you access. If the protection applied to the whole directory denies you read access, then you cannot access even those files in the directory that permit access to users in your group.

Write Modify or write to a directory. However, you must have both read and write access to a directory to create files in the directory, to rename files in the directory, or to perform any file operation that involves changes to the directory file.
Execute Access files by name but not list all the entries in a directory (that is, to use specific or implied wildcards) when applied to directories. For example, assume that you have execute access to the [JONES] directory, and you enter the following command:
$ DIRECTORY [JONES]

The system responds with an error message of "insufficient privilege or file protection violation" and does not list the files in the [JONES] directory. However, if you know that the file DATAFILE.DAT resides in the [JONES] directory, you can enter the following command:

$ TYPE [JONES]DATAFILE.DAT

The system displays the contents of the file. Thus, with execute access, you can perform some, but not all, of the operations that you can with read access. (Access to individual files is still controlled by their file protection.)

As another example, to display the contents of the EXPENSES.DAT file, you must have read or execute access to each directory in the directory tree, that is, to the JONES, REPORTS, and JUNE directories:

$ TYPE [JONES.REPORTS.JUNE]EXPENSES.DAT

Delete Delete a directory file. You must remove all entries from a directory before you can delete the directory file. When you create a directory with the CREATE/DIRECTORY command, you do not, by default, get delete access. If you want to be able to delete a directory file, you must use the DCL command SET SECURITY/PROTECTION to explicitly assign delete access to the owner category.
Control Change the characteristics of a directory.

Using UIC Directory Protection

You cannot completely protect a file without applying at least the same protection to the directory in which the file resides. For example, if you deny a user all access to a file but allow that user read access to the file's directory, the user cannot access the contents of the file but can see that it exists. Conversely, a user allowed access to a file and denied access to the file's directory (or one of the parent directories) cannot see that the file exists.

Note

To protect sensitive files, the directory protection alone is not adequate. You must also protect each individual file contained within the directory. Section 9.5.3 contains instructions for protecting disk files.

By default, top-level directories receive UIC-based protection (S:RWE,O:RWE,G:RE,W:E) and no ACL. A newly created subdirectory receives the same protection as its parent directory, but delete access is removed from all categories.

Guidelines for specifying UIC-based protection on a directory follow.

The following sections explain how to change directory protection characteristics and default ACL protection.

9.5.4.1 Changing Directory UIC Protection Characteristics

The DCL command SET DIRECTORY modifies the characteristics of one or more directories.

Example


$ SET DIRECTORY/OWNER_UIC=[360,020] [DAVIS],[USERS]

The SET DIRECTORY command in this example modifies both the [DAVIS] and [USERS] directories, changing their owner UICs. Using the /OWNER_UIC qualifier requires SYSPRV (system privilege).

9.5.4.2 Changing Default ACL Protection

You can override default UIC protection for specified directories or subdirectories by placing a default protection ACE in the ACL of the appropriate directory file. The default protection specified in the ACE is applied to any new file created in the specified directory or in any subdirectory of the directory.

Example

The following ACE, which must be in the ACL of a directory file, specifies that the default protection (for files created in the directory and its subdirectories) will allow system and owner processes full access, group processes read and execute access, and world users no access:


(DEFAULT_PROTECTION,S:RWED,O:RWED,G:RE,W:) 

9.5.5 Protecting Magnetic Tape Files

Because tapes are single-user devices, tape protection is only at the volume level. The protection codes for magnetic tape volumes are usually assigned with the INITIALIZE command.

You cannot use DCL commands to change protection characteristics on magnetic tape volumes. See Section 8.5.1 for more information.

9.6 Accessing Disk Files

This section describes how to use DCL commands to access files at the file level, not at the record level. This applies to reading files on disks, which is explained in this section, as well as to copying tape files, which is explained in Section 9.8.1.

Although DCL does allow you to manipulate files at the record level, for reasons of performance, you probably want to use a conventional programming language instead. Compaq recommends that you write programs using the OpenVMS Record Management Services (RMS) facilities, which are specifically designed to access files at the record level. You can write these programs in any higher-level language that the operating system supports.

To access disk files at the file level, you can use DCL commands. You cannot, however, use DCL commands to read or write files that are not in the standard formats supported by the operating system. If the file formats are not standard, you must mount the volumes on which they reside with the /FOREIGN qualifier to have read and write access.

Although the examples used in this section show how to access disk files on RA90 disk packs, they also apply to other devices.

To read the contents of a disk file, use the DCL command TYPE, which displays the contents of a file on your terminal. To find the exact location of the disk file you want to read, use the DCL command DIRECTORY.

How to Perform This Task

If, for example, you want to read the contents of a file named HISFILE, which is located somewhere in the directory [CHARLES] on a disk device whose logical name is DISK$DOCUMENT, follow these steps:

  1. Look for the exact location of HISFILE by entering the following command:


    $ DIRECTORY DISK$DOCUMENT:[CHARLES...]HISFILE.*
    

    This command instructs the operating system to search the entire [CHARLES] directory, including all the subdirectories, for all file types and version numbers of HISFILE.
    The following information is displayed on your terminal:


    Directory DISK$DOCUMENT:[CHARLES.MEMO]
    HISFILE.UPD;1
    Total of 1 file.
    

    This display informs you that only one version of HISFILE exists, that its file type is UPD, and that it resides in the [CHARLES.MEMO] directory.

  2. To read the contents of this file, enter the following command:


    $ TYPE [CHARLES.MEMO]HISFILE.UPD
    

    The contents of HISFILE are displayed on your terminal.

9.7 Accessing Tape Files

This section describes file-level access for tapes. When you request access to a standard-labeled volume or a file, the operating system checks at the volume and file level to ensure that your process can access the volume or file. The level at which the system checks access depends on the operation you request and the type of access the operation requires.

When you access a volume or a file, the operating system software reads the volume- and file-header labels to determine whether access to the volume or file is restricted. Which label is read depends on the operation requested. For example, if you want to mount a volume, your process must have access to it.

The protection set on a file determines your access to the file. The expiration date field in the header can prevent you from overwriting or appending to a file immediately preceding the one in question. If the expiration date field has not been reached, a file has not expired.

To overwrite an unexpired file, you must specify the /OVERRIDE=EXPIRATION qualifier when you mount the volume. Performing this operation requires that you have read or write access.

After a section that explains tape file names are sections that tell how to perform these tasks:
Task Section
Locate standard-labeled tape files Section 9.7.2
Use wildcards with tape files Section 9.7.3
Read files on tape volumes Section 9.7.4
Write files to tape volumes Section 9.7.5

9.7.1 Understanding Tape File Names

OpenVMS systems accept two types of file names for magnetic tapes:

Table 9-5 compares characteristics of OpenVMS extended names and standard names.

Table 9-5 Comparison of OpenVMS Extended Names and Standard Names
Characteristic OpenVMS Extended Names Standard Names
Valid with... Tape and disk volumes Tape volumes
Format filename.type;version filename.;version ( Version is optional.)
Length 39.39; 17.;
Valid Characters A through Z; 0 through 9; ampersand (&), hyphen (-), underscore ( _ ), and dollar sign ($); wildcard characters asterisk (*) and percent sign (%) ASCII "a" 1 characters enclosed in quotation marks (" "). Note that within a file name, DCL interprets a double set of quotation marks ("") as a single set ("). If a name has fewer than 17 characters, the system pads the name on the right with spaces to arrive at the 17-character maximum length.
Examples OPENVMS_FILENAME.DAT;23 "GENLABEL#123";2


1The ASCII "a" character set is defined in Clause 7.4.1 of the ISO 9660 Standard.

9.7.2 Locating Standard-Labeled Tape Files

Before accessing a particular file for a read or write operation, you might want to search the magnetic tape volume for that file. Use the DCL command DIRECTORY to locate a file or group of files on a tape volume.

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

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


Previous Next Contents Index

  [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]  
  privacy and legal statement  
6017PRO_041.HTML