File version

From VSI OpenVMS Wiki
Jump to: navigation, search

A file version number is a part of the file specification preceded with a semicolon (;) or a period(.) that tells you which version of the file that is. Each file version is stored as a separate file with different FIDs.

Version numbers are decimal numbers from 1 to 32,767. When you create a file with a file name that is unique in the directory, the file is assigned version number 1 (unless a different version number is explicitly specified). If a file with a non-unique name is created, it is assigned the next file version. If you attempt to create a new file with a version number higher than 32767, you will receive an error message.

Version number defaults

Various commands default to different version numbers.

Command Default version numbers
TYPE Highest version number
DIRECTORY All version numbers
PURGE All version numbers but the highest (you cannot specify a version number; if you need to keep more than one version, use the /KEEP qualifier)
DELETE No default (version must be specified explicitly)

Relative version numbers

Relative version numbers can be used to point to various versions of a file if the actual file versions are unknown.

Relative version number Meaning
None (;) Highest version
0 Highest version
-1 Second highest version
-2 Third highest version
-0 Lowest version

Version limit

A version limit can be imposed on a file or all files created in a given directory. If a file version is created beyond the limit, the lowest existing version of that file will be purged.

To set a version limit on a file, use the SET FILE/VERSION_LIMIT=n command. By default, the version limit is 0, which means unlimited versions (the number is still limited by the Files-11 architectural limit of 32,767. To set a version limit on all files created in a certain directory, use the /VERSION_LIMIT qualifier with the SET DIRECTORY or CREATE/DIRECTORY command. To view the version limit on a file, use the DIRECTORY/FULL command or F$FILE_ATTRIBUTES(filename,"VERLIMIT") lexical function.

See also