CL Command Reference - REN
CL Command List > REN Reference
Description:
The Rename Object (REN) command changes the name of an object in a directory.
This command is an alias for the Rename Object (RNM) command and can also be issued using the following alternative command names:
. RNM
Restrictions:
1. This command works on only one object. If a pattern is specified on the Object (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 fails with error message CPFA08E, ¡åMore than one name matches pattern.¡å.
2. When renaming an object in the ¡åroot¡å (/), QOpenSys or user-defined file systems, the user must have object management (*OBJMGT) authority to the object to be renamed, and write, execute (*WX) authority to the directory that contains the object. If the object to be renamed is a directory, the user must also have write (*W) authority to the directory.
3. The user must have execute (*X) authority to each directory in the path.
4. A user cannot rename 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.
5. The authority requirements and restrictions from the existing Rename Object (RNMOBJ) command and Rename Document Library Object (RNMDLO) command apply to objects in the QSYS.LIB, independent ASP QSYS.LIB, and QDLS file systems.
6. In the QSYS.LIB and independent ASP QSYS.LIB file systems, the new name must contain the same object type suffix.
7. Some objects cannot be renamed. An error is returned if an attempt is made to rename these objects.
8. The file cannot be renamed if the file is a DataLink column in an SQL table and where a row in that SQL table references this file.
Examples:
The alternative command name for REN is RNM. The following examples use the alternative command name, but REN can be replaced directly for RNM in all of them.
Example 1: Renaming an Object Link
RNM OBJ(¡¯DECEMBER-1994-MONTHLY-PAYROLL-FILE¡¯)
NEWOBJ(¡¯JANUARY-1995-MONTHLY-PAYROLL-FILE¡¯)
This command renames a file named DECEMBER-1994-MONTHLY-PAYROLL-FILE to a file named JANUARY-1995-MONTHLY-PAYROLL-FILE.