The File System

Files


A file is merely a
collection of characters stored somewhere in the system in an orderly and retrievable fashion. Most characters stored in files are alphabetic or numeric, but any characters that appear on a keyboard may be stored. Additionally, non-printing characters such as control sequences may be stored in files. Files whose collection of stored characters supply encoded instructions to the system and which can be executed as well as read are generally called programs.

Files are identified to the system using a unique identifier called the file specification, which can include disk and directory names as well as node names for accessing files across the network.

File Names, File Types, and Versions

On VMS systems, file names are usually thought of as having three parts*1: the filename, the file type, and the version number. A file specification typically looks like the following:

FILE_NAME.EXT;1

Filename

This is the part of the file specification by which the file is commonly known; it can be up to 39 characters in length. Some software and commands need only the filename to uniquely identify the file, but usually you will also specify the file type.

File Type

The file type identifies the structure or type of data in the file. It consists of a period followed by an identifier of up to 39 characters, but is typically 3 characters. Table 3.1 lists some of the more common file types, many of which are supplied by the system (or software) by default. The file types listed in the table are not required, but are strongly recommended.

Version

The last part of a file specification is the version number. This is a semicolon and a number between 1 and 32,767. Each time a file is revised, the version number is increased by one.

When old versions of files start building up, it is time for some housecleaning. Old versions of files can be removed using the PURGE command. See "Removing Multiple Versions of Files: PURGE" on page 53.

You can limit the number of versions that the system maintains, for example, to set a limit of 50 versions, type:

$ SET FILE/VERSION_LIMIT=50 LOGIN.COM


Table 3.1: VMS File Types

Disks and Directories

Files are stored on some type of device--usually a magnetic disk drive, although they can also be stored on tape, CD-ROM, or some other type of media. Most of the files you will use on a day-to-day basis will be stored on disk, so we will focus on disks here (for information about using tapes or CD-ROMs, see Chapter 10 on page 169). When typing a file specification, the device name is followed by a colon. A sample device name is:

DISK$SCRATCH:
The storage area of a magnetic disk is logically organized in a hierarchical structure of directories (working with directories will be discussed in more detail on page 48). The name of the directory is enclosed in square brackets, for example [DOCS]. Often, you will use directory names in conjunction with device names, for example, when copying files from one disk to another. When you do this, the directory name follows the device name. For example:

$ COPY DISK$SCRATCH:[JONES]LOGIN.COM DISK$DATA:[SMITH]JL.COM

Clusters, Nodes, and Networks

Although most users tend to work mostly with files
on a local system, the VMS file system actually identifies files using the complete file specification, which includes disk and directory names as well as node names for accessing files across the DECnet network. By using the node names (or numbers), you can copy files to disks on other VMS hosts, either inside the Institute or anywhere else with a reachable node. When specifying a remote node, the node name (or number) is followed by two colons.

The full file specification, with node name, device, directory, file name, file type, and version being specified is shown in Figure 3.1. We will use variations of file specification in examples throughout of this manual.



Figure 3.1: File Specification

Wildcards

Wildcards offer a way to
operate on groups of files according to a common filename characteristic. There are two wildcard characters:

   $ TYPE DISTRICT%.DAT 
Wildcards can also be used in directories, as in DIR [STSDAS.*].

Wildcards are especially valuable with commands such as DIRECTORY, DELETE, or COPY. For example, suppose that you want to see every file in the current directory with a file type of .DAT, regardless of its file name or version number, you would type the following command:

$ DIR *.DAT;*
Similarly, you could use wildcards for the file name or type. For example, suppose you have a document directory that includes some ASCII text files and some TEX files, among hundreds of other files. You could list all of the text and TEX files (as well as anything else with a file type starting in "T") using the following command:

$ DIR *.T*;*
File Names, File Types, and Versions
Filename
File Type
Version
Table 3.1: - VMS File Types
Disks and Directories
Clusters, Nodes, and Networks
Figure 3.1: - File Specification
Wildcards

Generated with CERN WebMaker