From VSI OpenVMS Wiki
Jump to: navigation, search

An alias is a File ID that several directory entries point to. It looks like a file but is actually only a link to the real file. ODS-5 volumes can support hard links - aliases that point to the same FID independently and can be deleted independently like files without riskingto delete the actual file.

Soft links vs hard links

A system that uses hard links keeps track of the number of links for each file; a system that does not use hard links displays link counts of 0. When the original file is deleted by its original name on a system with hard links enabled, the file remains accessible through any of the hard links. When the original file is deleted by its original name on a system without hard links enabled, the actual file (i.e. header) is deleted and all the aliases turn into dangling directory entries.

Link count

Link count is displayed with the DIRECTORY/FULL and DIRECTORY/LINK commands. If hard links are enabled on the system, the actual link count is displayed; otherwise 0 is displayed.

File systems

Soft links are supported by ODS-2 and ODS-5; hard links are only supported by ODS-5 systems and need to be enabled to be used.

Creating aliases

To create an alias, use SET FILE file_name /ENTER=alias_name. If hard links are enabled on the volume, a hard link will be created; otherwise a soft link will be created.

Deleting aliases

To delete an alias or the original name of the file, use SET FILE file_name /REMOVE=alias_name. This command enables you to remove one of the names of the file without deleting the file. If you use this command to remove the name of a file that has only one name, you cannot access that file until you use ANALYZE/DISK_STRUCTURE to retrieve it.