CL Command Reference - ERASE
CL Command List > ERASE Reference
Description:
The Remove link (ERASE) command removes the link to the specified object. If this is the only hard link to the object, the object is removed when no longer in use. The object can be removed even if a symbolic link to it exists. The symbolic link remains until it is removed.
This command is an alias for the Remove link (RMVLNK) command and can also be issued using the following alternative command names:
. DEL
. RMVLNK
Restrictions:
1. In the ¡åroot¡å (/), QOpenSys, and user-defined file systems, the user must have write, execute (*WX) authority to the directory containing the object. If a hard link is to be unlinked, the user must also have object existence (*OBJEXIST) authority to the object.
2. In the QDLS file system, the user must have all (*ALL) authority to the object and execute (*X) authority to the parent directory.
3. The user must have *X authority to each directory in the path.
4. See the iSeries Security Reference, SC41-5302 book for the authority requirements for other file systems.
5. A user cannot unlink an object within a ¡åroot¡å (/), QOpenSys, or user-defined file system directory that has the ¡årestricted rename and unlink¡å attribute set on (this attribute is equivalent to the S_ISVTX mode bit) unless one or more of the following are true:
a. The user is the owner of the object.
b. The user is the owner of the directory.
c. The user has all object (*ALLOBJ) special authority.
6. A directory cannot be unlinked.
7. The link to a file cannot be removed if the file is a DataLink column in an SQL table and where a row in that SQL table references this file.
8. The restrictions listed above are for the i5/OS objects of the types *DDIR, *DSTMF, *SOCKET, *STMF, and *SYMLNK.
Examples:
The alternative command name for ERASE is RMVLNK. The following examples use the alternative command name, but ERASE can be replaced directly for RMVLNK in all of them.
Example 1: Removing an Object Link
RMVLNK OBJLNK(¡¯PAY¡¯)
This command removes a link named PAY.