CL Command Reference - ADDLNK

CL Command List > ADDLNK Reference

Description:

The Add Link (ADDLNK) command adds a link to an object. The New link (NEWLNK) parameter specifies the name for the new link. The Object (OBJ) parameter specifies the current name of the object that is to receive the new link. After the link is established the object may be referred to by either the old name or the new name.

Restrictions:

1. This command works on only one object. If a pattern is specified on the OBJ parameter and more than one object matches the pattern, the user can select the object from a list in an interactive job. If this is a batch job, the command will fail with error message CPFA08E ¡åMore than one name matches pattern.¡å. A pattern is not allowed if the LNKTYPE is symbolic, because the object is not required to exist.

2. The user must have write (*W) and execute (*X) authority to the directory that contains the new link. If a hard link is to be added, the user must also have object existence (*OBJEXIST) authority to the existing object and *X authority to each of the path name prefixes of the OBJ name.

3. A hard link cannot be created to a symbolic link. When LNKTYPE(*HARD) is specified and the OBJ parameter names a symbolic link, the link is created to the resolved object (which must exist).

4. A hard link cannot be created to a directory.

5. A hard link cannot be created to an object in another file system.

6. No links can be created in the QSYS.LIB, independent ASP QSYS.LIB or QDLS portion of the name space.



Examples:

Example 1: Adding a Symbolic Link

ADDLNK OBJ(¡¯DECEMBER-1994-MONTHLY-PAYROLL-FILE¡¯) NEWLNK(¡¯PAY¡¯)

This command adds a symbolic link named ¡åPAY¡å to the DECEMBER-1994-MONTHLY-PAYROLL-FILE.


Example 2: Adding a Symbolic Link to a Source File

ADDLNK OBJ(¡¯/QSYS.LIB/MYLIB.LIB/F1.FILE/P1.MBR¡¯)
NEWLNK(¡¯PGM1¡¯) LNKTYPE(*SYMBOLIC)

This command adds a symbolic link from the user¡¯s current directory (not in QSYS.LIB, independent ASP QSYS.LIB, or QDLS) to a member in a source file in QSYS.LIB.


Example 3: Adding a Hard Link

ADDLNK OBJ(¡¯/QOpenSys/MYDIR/FILE1¡¯) NEWLNK(¡¯FILE2¡¯)
LNKTYPE(*HARD)

This command adds a hard link from the user¡¯s current directory, with the name FILE2, to FILE1 in /QOpenSys/MYDIR.