CRTDIR (Create Directory)

CRTDIR Command syntax diagram

 

Purpose

The Create Directory (CRTDIR) command adds a new directory to the system. A directory is an object that contains the names of other objects. Libraries and folders are types of directories. When a directory is created, a link is added to the directory prefix. The directory must have been created before any objects can be placed into it.

This command can also be issued using the following alternative command names:

For more information about integrated file system commands, see the Integrated file system topic in the File systems and management category of the Information Center.

 

Restrictions

  1. The following restrictions apply when the directory being created is a library in

    the QSYS.LIB or independent ASP QSYS.LIB file system,

    , or a directory within the root directory or QOpenSys file system:

    • The *AUDIT special authority is required when specifying a value other than *SYSVAL on the CRTOBJAUD parameter.


  2. The following restriction applies when the directory being created is a folder in an existing folder in QDLS:

    • The *CHANGE authority is required for the existing folder.


  3. The user must have *X authority to each directory in the path.
  4. When creating a directory in the root directory or QOpenSys file system, the user must have *WX authority to the directory that contains the new directory.
  5. When creating a directory, the owner ID (UID) is the user creating the directory.

    If the directory is being created in the Root ('/'), QOpensys, and user-defined file systems, the following applies. If the S_ISGID bit of the parent directory is off, the group ID (GID) is set to the effective GID of the thread creating the directory. If the S_ISGID bit of the parent directory is on, the group ID (GID) of the new directory is set to the GID of the parent directory.

    If the directory is being created in the QSYS.LIB or independent ASP QSYS.LIB file system, the GID is obtained from the primary user profile. For all other file systems,

    the GID is obtained from the parent directory.

 

Required Parameters

DIR
Specifies the path name of the directory being created. See path names for more information on specifying path names.

Note: Do not use a name that begins with the character Q. The system assumes that libraries or directories with those names are system libraries or directories.

 

Optional Parameters

DTAAUT
Specifies the public data authority given to the user for the directory.

*INDIR: The authority for the directory being created is determined by the directory it is being created in. The directory immediately preceding the new directory determines the authority. A directory created in the root is assigned the public authority given to objects in the root directory. A directory created in QDLS for a folder defaults to *EXCLUDE for a first level folder. If created in the second level or greater, the authority of the previous level is used. The QOpenSys and root file systems use the parent directory's DTAAUT value. If the value *INDIR is specified for either the OBJAUT parameter or the DTAAUT parameter, then *INDIR must be specified for both parameters.

*RWX: The user can change the object and perform basic functions on the object except those limited to the owner or controlled by object existence, object management, object alter and object reference authority. *RWX provides object operational authority and all data authorities.

*RW: The user can view and modify the contents of an object. *RW authority provides object operational authority and data read, add, update and delete authorities.

*RX: The user can perform basic operations on the object, such as run a program or display the contents of a file. The user is prevented from changing the object. *RX authority provides object operational authority and read and execute authorities.

*WX: The user can modify the contents of an object and run a program or search a library or directory. *WX authority provides object operational, and data add, update, delete, and execute authorities.

*R: The user can view the contents of an object. *R authority provides object operational authority and data read authority.

*W: The user can modify the contents of an object. *W authority provides object operational authority and data add, update, and delete authorities.

*X: The user can run a program or search a library or directory. *X authority provides object operational authority and data execute authority.

*EXCLUDE: The user cannot access the object. The OBJAUT value must be *NONE, if this special value is used.

*NONE: The user is given no data authorities to the objects. This value cannot be used with OBJAUT value of *NONE.

authorization-list-name: Specify the name of the authorization list used. The format of the authorization list name remains the current ten-character format. The OBJAUT value must be *NONE, if this special value is used.

OBJAUT
Specifies the public object authority given to users for the directory.

*INDIR: The object authority is based on the authority for the directory where this directory is being created. If the value *INDIR is specified for either the OBJAUT parameter or the DTAAUT parameter, then *INDIR must be specified for both parameters.

*NONE: None of the other object authorities (existence, management, alter or reference) are given to the users. If *EXCLUDE or an authorization list is specified for the DTAAUT parameter, *NONE must be specified. This value cannot be used with the DTAAUT value of *NONE.

*ALL: All of the other object authorities (existence, management, alter, and reference) are given to the users.

You can specify up to four of the following values:

*OBJEXIST: The user is given object existence authority to the object. The user can control existence and ownership, delete, free storage of the object, perform save/restore operations and transfer ownership of the object.

*OBJMGT: The user is given object management authority to the object. With this authority the user can specify security for the object, move or rename the object and add members to database files.

*OBJALTER: The user is able to alter the attributes of the objects. On a database file, the user can add and remove triggers, add and remove referential and unique constraints, and change the attributes of the database file. With this authority on an SQL package, the user can change the attributes of the SQL package. Currently, this authority is used only for database files and SQL packages.

*OBJREF: The user is given object reference authority to objects. Used only for database files, the user can refer to an object from another object such that operations on that object may be restricted by the other object. On a physical file, the user can add a referential constraint in which the physical file is the parent.

CRTOBJAUD
Specifies the auditing value of objects created in this directory.

Note: This parameter is ignored when using this command in QDLS. No error message is sent and the directory is created.

*SYSVAL: The object auditing value for the objects in the directory is determined by the system auditing value

(QCRTOBJAUD)

.

*NONE: Using or changing this object will not cause an audit entry to be sent to the security journal.

*USRPRF: The user profile of the user accessing this object is used to determine if an audit record will be sent for this access. The OBJAUD keyword of the CHGUSRAUD command is used to turn on auditing for a specific user.

*CHANGE: All change accesses to this object by all users are logged.

*ALL: All change or read accesses to this object by all users are logged.

Example for CRTDIR

CRTDIR   DIR('MYDIR')

This command creates the directory MYDIR and adds it to the current directory. The authority and auditing defaults are used.

Error messages for CRTDIR

*ESCAPE Messages

CPFA085
Home directory not found for user &1.
CPFA089
Pattern not allowed in path name.
CPFA09C
Not authorized to object.
CPFA09D
Error occurred in program &1.
CPFA0A0
Object name already exists.
CPFA0A1
An input or output error occurred.
CPFA0A3
Path name resolution causes looping.
CPFA0A6
Number of links exceeds maximum allowed for the file system.
CPFA0A7
Path name too long.
CPFA0A9
Object not found.
CPFA0AA
Error occurred while attempting to obtain space.
CPFA0AB
Object name not a directory.
CPFA0AD
Function not supported by file system.
CPFA0B1
Requested operation not allowed. Access problem.