skip book previous and next navigation links
go up to top of book: HP OpenVMS System Manager's Manual, Volume 1:... HP OpenVMS System Manager's Manual, Volume 1:...
go to beginning of chapter: Using Files and Directories Using Files and Directories
go to previous page: Protecting Files Protecting Files
go to next page: Accessing Tape FilesAccessing Tape Files
end of book navigation links

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 Copying Files to Disk Volumes.

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

go to previous page: Protecting Files Protecting Files
go to next page: Accessing Tape FilesAccessing Tape Files