IBM Support

Explanation of a Symbolic Link and How to Create It

Troubleshooting


Problem

This document provides an explanation of a symbolic link and how to create it

Resolving The Problem

What is a Symbolic Link?

Symbolic links are objects within the integrated file system that contain a path to another object.

A symbolic link, which is also called a soft link, is similar to a shortcut in that it 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 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.

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 do the following:

o Access a database file member in the QSYS.LIB or independent ASP QSYS.LIB file systems.
o Access a document in the QDLS file system.


How to Create a Symbolic Link

To create a symbolic link, issue the ADDLINK command as follows:

ADDLNK OBJ('/company_abc/division_123/site_xyz/building_456/team_789/payroll') NEWLNK('/Rochester_IT/payroll') LNKTYPE(*SYMBOLIC)

The above example will allow a user or program to access the payroll file in /company_abc/division_123/site_xyz/building_456/team_789/payroll by going through the symbolic link of /Rochester_IT/payroll

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0"}]

Historical Number

503511757

Document Information

Modified date:
11 November 2019

UID

nas8N1013397