Symbolic link

A symbolic link, which is also called a soft link, is a path name contained in a file.

When the system encounters a symbolic link, it follows the path name provided by the symbolic link and then continues on any remaining path that follows the symbolic link. If the path name begins with a /, the system returns to the / ("root") directory and begins following the path from that point. If the path name does not begin with a /, the system returns to the immediately preceding directory and follows the path name in the symbolic link beginning at that directory.

Consider the following example of how a symbolic link might be used:

Figure 1. An example of using a symbolic link
An example of using a symbolic link

You select a menu option to show the status of customer accounts. The program displaying the menu uses the following path name:

     /Customer/Status/Summary

The system follows the Customer link, which leads to a directory 1, and then follows the Status link. The Status link is a symbolic link, which contains a path name 2. Because the path name begins with a /, the system returns to the / ("root") directory and follows the links Records and Accounts in sequence. This path leads to another directory 3. Now the system completes the path in the path name provided by the program. It follows the Summary link, which leads to a file 4 containing the data you will need.

Unlike a hard link, a symbolic link is an object (of object type *SYMLNK); it can exist without pointing to an object that exists. You can use a symbolic link, for example, to provide a path to a file that will be added or replaced later.

Also unlike a hard link, a symbolic link can cross file systems. For example, if you are working in one file system, you can use a symbolic link to access a file in another file system. Although the QSYS.LIB, independent ASP QSYS.LIB, and QDLS file systems do not support creating and storing symbolic links, you can create a symbolic link in the "root" (/) or QOpenSys file system that allows you to: