MIDRANGE dot COM Mailing List Archive

Home » MIDRANGE-L » January 2014

Re: Setting the PC read-only attribute in IFS


On 07-Jan-2014 05:51 -0800, Alan Cassidy wrote:
I've looked at the archives, searched on the Web, and so it's come
to this...

The IFS root directory apparently stores the PC read-only attribute.
I'm creating some files in an IFS root subfolder and need to know if
it is possible to create it with the read-only attribute set, or at
least to change the attribute after creating the file.

Paraphrasing from a reply to a similar inquiry:

I am unaware of the ability to set the attribute during any particular /create/ interface; e.g. the Qshell touch utility does not have an option. Although after-the-fact, i.e. not as-specified during the create of the file, a later request can be made to change that attribute\setting using:

CHGATR 'path-to-object' ATR(*HIDDEN) VALUE(*YES)

And optionally with SUBTREE(*YES) if the specified OBJ() is a directory, to set for all objects under that directory]


_i Change Attribute (CHGATR) i_
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 specified directory, its contents, and the contents of all of its subdirectories have the attribute changed. If SUBTREE(*ALL) is specifed, the command will attempt to change the attribute for as many objects as possible within the subtree. A diagnostic message will be sent for each object that could not have its attribute changed. When all of the objects have been attempted, an escape message will be sent if there were any errors. If all of the objects had the attribute changed with no errors, then a completion message will be sent.

Attribute (ATR)

Specifies the attribute to be changed.

Whether the object can be displayed using an ordinary directory list.

Allowed values for the VALUE parameter are:

*YES The object is hidden and cannot be displayed using an ordinary directory listing.
*NO The object is not hidden and can be displayed using an ordinary directory listing.


The same function as ChgAtr CL command is available from the following API and shell (QSH) utility:

_i Qp0lSetAttr()--Set Attributes i_
Service Program Name: QP0LLIB3
_Attribute identification_ The constant identifying the attribute being set. Valid values are:
18 QP0L_ATTR_PC_HIDDEN: (CHAR(1)) Whether the object can be displayed using an ordinary directory listing.
x'00' QP0L_PC_NOT_HIDDEN: The object is not hidden.
x'01' QP0L_PC_HIDDEN: The object is hidden.

IBM i 7.1 Information Center -> Programming -> Shells and utilities -> Qshell -> Utilities -> Working with files and directories
_i attr - Get or set attributes for files i_

attr [ -hp ] file [ attribute [ =value ] ... ]


The attr utility gets or sets attributes for the object specified by file. When no attributes are specified, attr displays all of the attributes for the object in a re-entrable format to standard output.

An indicator if the object is hidden. This attribute can be displayed or set.

Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact