RPGIV @ Work

A unique site for RPG and System i Lovers


Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

Change Attribute (CHGATR) Print E-mail
User Rating: / 1
Written by Chamara Withanachchi   

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.

  1. The user must have execute (*X) authority to the directories in the path name prefixes.
  2. When doing subtree processing, the user must have read (*R) and *X authorities to the path name and all subdirectories within that path.
  3. 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.
  4. 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, except the *ALWCKPWRT, *ALWSAV, *USECOUNT *DISKSTGOPT or *MAINSTGOPT attributes.
  5. 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.
  6. Changing attribute *ALWCKPWRT for a directory object fails and returns error messages CPFA0AD and CPFB414.
  7. 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.
  8. QDLS file system requires the user to have *W and *OBJMGT authorities to change the *USECOUNT attribute.
  9. This command is conditionally threadsafe. The following restriction applies:

    This command is not threadsafe if the object on which this function is operating resides in a file system that is not threadsafe. Only the following file systems are threadsafe for this function:

    • "Root" (/)
    • QOpenSys
    • User-defined
    • QNTC
    • QSYS.LIB
    • Independent ASP QSYS.LIB
    • QOPT
    • Network File System
    • QFileSvr.400

Specifies the attribute to be changed.

Property Description
*READONLY Whether a file can be changed or deleted.
*HIDDEN Whether a file is displayed in an ordinary directory list.
*PCSYSTEM Whether a file is considered as belonging to a PC.
*PCARCHIVE Whether a file has been changed since the last save by a PC.
*SYSARCHIVE Whether a file has been changed since an iSeries save.
*ALWCKPWRT Whether a stream file can be shared during save-while-active checkpoint processing.
*USECOUNT The number of days an object has been used.
*DISKSTGOPT How the system allocates auxiliary storage for an object.
*MAINSTGOPT How the system allocates main storage for an object.
<Previous   Next>