CL Command Reference - CHGATR
CL Command List > CHGATR Reference
Description:
The Change Attribute (CHGATR) command allows a single attribute to be changed for a single object or a group of objects. An object name pattern can be used to change a single attribute for a group of related objects.
The CHGATR command can also be used to change an attribute of a directory tree where the directory, its contents, and the contents of all of its subdirectories have the attribute changed. A subtree change attribute will attempt to change the attribute for as many objects as possible. A diagnostic message will be sent for each object that could not have its attribute changed and when all of the objects have been attempted, an escape message will be sent. If all of the objects had the attribute changed with no errors, then a completion message will be sent.
Restrictions:
1. The user must have execute (*X) authority to the directories in the path name prefixes, except when changing the *CRTOBJAUD attribute.
2. When doing subtree processing, the user must have read (*R) and *X authorities to the path name and all subdirectories within that path, except when changing the *CRTOBJAUD attribute.
3. The user must have all object (*ALLOBJ) and security administrator (*SECADM) special authorities when changing the *CRTOBJSCAN or *SCAN attributes.
4. The user must either own the object or have all object (*ALLOBJ) special authority in order to set the *RSTDRNMUNL, *SETUID, and *SETGID attributes for that object.
5. The user must have audit (*AUDIT) special authority in order to set the *CRTOBJAUD attribute for the directory object.
6. For all file systems, except QSYS.LIB, independent ASP QSYS.LIB, and QDLS, the user must have object management (*OBJMGT) authority to the object when changing the *ALWCKPWRT, *ALWSAV, *USECOUNT, *DISKSTGOPT or *MAINSTGOPT attributes.
7. For all file systems, except QSYS.LIB, independent ASP QSYS.LIB, and QDLS, the user must have write (*W) authority to the object when changing any attribute unless noted otherwise.
8. Changing attribute *ALWCKPWRT for a directory object fails and returns error messages CPFA0AD and CPFB414.
9. QSYS.LIB and independent ASP QSYS.LIB file systems require the user to have object operational (*OBJOPR) and object management (*OBJMGT) authorities to change the *USECOUNT attribute if the object type is *FILE, to have *X and *OBJMGT authorities to change *USECOUNT if the object is a database file member, and to have *OBJMGT authority to change *USECOUNT if the object is neither a *FILE or database file member.
10. QDLS file system requires the user to have *W and *OBJMGT authorities to change the *USECOUNT attribute.
11. This command is conditionally threadsafe.
Examples:
Example 1: Change Attribute for a Directory Subtree
CHGATR OBJ(¡¯/MYINFO¡¯) ATR(*HIDDEN) VALUE(*YES) SUBTREE(*ALL)
The object MYINFO will have its *HIDDEN attribute changed so it is a hidden object. If MYINFO is a directory, then all of the objects this directory contains as well as all of the objects contained in the subdirectories will have their PC hidden attribute changed because *ALL is specified for the SUBTREE parameter.