Create Library (CRTLIB)

The Create Library (CRTLIB) command adds a new library to the system. Before any objects are placed into a library, the library must have been created. When the library is created, it appears as though it exists in the QSYS (system) library.

Restrictions:

  1. A library with the name QRCL or QRPLOBJ can only be created in the system ASP (ASP 1).
  2. A library with the name QRCLxxxxx or QRPLxxxxx can only be created in the ASP for which the ASP number corresponds to 'xxxxx' (where 'xxxxx' is the number of a primary ASP right adjusted and padded on the left with zeros); for example, library QRPL00033 can only be created in the ASP device corresponding to ASP number 33.
  3. When library QSPLnnnn is created in a primary or secondary ASP, it must be created in the ASP for which the ASP number corresponds to 'nnnn' (where 'nnnn' is the number of a primary or secondary ASP right adjusted and padded on the left with zeros).
  4. You cannot create a library with the name QSYSxxxxx, QSYS2xxxxx, or SYSIBxxxxx (where 'xxxxx' is a number).

Parameters

Keyword Description Choices Notes
LIB Library Name Required, Positional 1
TYPE Library type *PROD, *TEST Optional, Positional 2
TEXT Text 'description' Character value, *BLANK Optional
AUT Authority Name, *LIBCRTAUT, *CHANGE, *ALL, *USE, *EXCLUDE Optional
ASP ASP number 1-32, 1, *ASPDEV Optional
ASPDEV ASP device Name, *ASP, *ASPGRPPRI, *SYSTEM Optional
CRTAUT Create authority Name, *SYSVAL, *CHANGE, *ALL, *USE, *EXCLUDE Optional
CRTOBJAUD Create object auditing *SYSVAL, *NONE, *USRPRF, *CHANGE, *ALL Optional

Library (LIB)

Specifies the library to be created.

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

This is a required parameter.

name
Specify the name of the library to be created.

Library type (TYPE)

Specifies the type of library to be created.

*PROD
This is a production library. Database files in production libraries cannot be opened for updating if a user is in debug mode and he requested that production libraries be protected. A user can protect all database files in production libraries from updates by specifying *NO for the Update production files (UPDPROD) parameter on the Start Debug (STRDBG) command to begin testing. However, this protection does not prevent the program from deleting database files or from changing other objects (such as data areas) in the library.
*TEST
This is a test library. All objects in a test library can be updated during testing, even if special protection is requested for production libraries.

Text 'description' (TEXT)

Specifies the text that briefly describes the library.

*BLANK
The text is set to blanks.
'description'
Specify no more than 50 characters of text, enclosed in apostrophes.

Authority (AUT)

Specifies the default public authority for this library. This is the authority you are giving to a user who does not have specific authority for the library, who is not on an authorization list specified for the library, and whose group profiles have no specific authority for the library.

*LIBCRTAUT
The authority for the library is the same as the create authority for the QSYS library. The create authority for the QSYS library can be displayed by using the Display Library Description (DSPLIBD) command. If the create authority for QSYS is changed with the Change Library (CHGLIB) command, the new authority will not affect existing libraries.
*CHANGE
Change (*CHANGE) authority provides the authority needed to perform all operations on the library except those limited to the owner or controlled by object existence (*OBJEXIST) and object management (*OBJMGT) authorities. The user can change and perform basic functions on the library. Change (*CHANGE) authority provides object operational (*OBJOPR) authority and all data authority.
*ALL
All (*ALL) authority provides the authority needed to perform all operations except those limited to the owner or controlled by authorization list management (*AUTLMGT) authority. The user can control the library's existence, specify the security for the library, change the library, and perform basic functions on the library. The user also can change ownership of the library.
*USE
Use (*USE) authority provides the authority needed to perform basic operations on the library, such as running a program or reading a file. The user cannot change the library. Use (*USE) authority provides object operational (*OBJOPR), read (*READ), and execute (*EXECUTE) authorities.
*EXCLUDE
The user cannot access the library.
name
Specify the name of an authorization list. Users included on the authorization list are granted authority for the library as specified by the list. The authorization list must exist when the library is created.

ASP number (ASP)

Specifies the number of the system or basic user auxiliary storage pool (ASP) where storage for the library is allocated. For libraries created in an ASP, all objects in the library must be in the same ASP as the library. When a value other than *ASP is specified for the ASP device (ASPDEV) parameter, *ASPDEV is the only valid value that can be specified for the ASP number (ASP) parameter, if specified. Also when a value other than *ASP is specified for the ASPDEV parameter, the ASP parameter can be omitted and its defaulted value will be ignored.

1
The storage space for the library is allocated from the system auxiliary storage pool ASP 1.
*ASPDEV
The storage for the library is allocated from the primary or secondary ASP specified for the ASPDEV parameter.
number
Specify a value ranging from 1 through 32 that is the number of the system or basic user ASP.

ASP device (ASPDEV)

Specifies the auxiliary storage pool (ASP) device name where storage is allocated for the library. When a value other than *ASPDEV is specified for the ASP number (ASP) parameter, ASPDEV(*ASP) is the only valid value for the ASP device (ASPDEV) parameter, if specified. Other values for the ASPDEV parameter are valid if the ASP parameter is omitted. In this case, the defaulted value for the ASP parameter is ignored.

*ASP
The storage for the library is allocated from the system or basic user ASP specified for the ASP parameter.
*ASPGRPPRI
The storage for the library is allocated from the primary ASP of the thread's ASP group. If no ASP group is associated with the thread an error message is sent.
*SYSTEM
The storage for the library is allocated from the system ASP (ASP 1).
name
Specify the name of a primary or secondary ASP device. The storage for the library is allocated from the primary or secondary ASP. The primary or secondary ASP must have been activated (by varying on the ASP device) and have a status of 'Available'.

Note: To specify a specific auxiliary storage pool (ASP) device name, you must have use (*USE) authority for each ASP device in the ASP group.

Create authority (CRTAUT)

Specifies the default public authority for an object created into this library. This is the authority given to a user who does not have specific authority for the object, who is not on an authorization list specified for the object, and whose user groups have no specific authority for the object.

When the user creates an object into this library, the Authority (AUT) parameter on the create command for the object determines the public authority for the object. If the AUT value on the create command for the object is *LIBCRTAUT, the public authority for the object is set to the CRTAUT value for the library.

*SYSVAL
The default public authority will be determined by the value of the QCRTAUT system value when an object is created into this library.
*CHANGE
The user can perform all operations on the object except those limited to the owner or controlled by object existence (*OBJEXIST) and object management (*OBJMGT) authorities. The user can change and perform basic functions on the object. *CHANGE authority provides object operational (*OBJOPR) authority and all data authority. If the object is an authorization list, the user cannot add, change, or remove users.
*ALL
The user can perform all operations except those limited to the owner or controlled by authorization list management (*AUTLMGT) authority. The user can control the object's existence, specify the security for the object, change the object, and perform basic functions on the object. The user also can change ownership of the object.
*USE
The user can perform basic operations on the object, such as running a program or reading a file. The user cannot change the object. Use (*USE) authority provides object operational (*OBJOPR), read (*READ), and execute (*EXECUTE) authorities.
*EXCLUDE
The user cannot access the object.
name
Specify the name of the authorization list whose authority is used for the object.

Create object auditing (CRTOBJAUD)

Specifies the auditing value for objects created in this library.

Note: To specify a value other than *SYSVAL for this parameter, you must have audit (*AUDIT) special authority.

*SYSVAL
The auditing value will be determined by the value of the QCRTOBJAUD system value when an object is created into this library.
*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 entry will be sent to the security journal for the access. The Object auditing value (OBJAUD) parameter on the Change User Auditing (CHGUSRAUD) command is used to turn auditing on for a specific user.
*CHANGE
All change access to this object by all users will cause an audit entry to be sent to the security journal.
*ALL
All change or read access to this object by all users will cause an audit entry to be sent to the security journal.

Examples

Example 1: Creating a Production Library

CRTLIB   LIB(MYLIB)  TEXT('My Production Library')

The library MYLIB is added to the system. The library is a production library; only the owner has object existence (*OBJEXIST) and object (*OBJMGT) management authorities for it. The authority for other users for library MYLIB is determined by the create authority of library QSYS, since *LIBCRTAUT was assumed for the AUT parameter. The text, 'My Production Library', is displayed whenever the library description for MYLIB is displayed.

Example 2: Creating a Test Library

CRTLIB   LIB(Z)  TYPE(*TEST)  AUT(*EXCLUDE)
         TEXT('This is a test library')

Test library Z is added to the system. Only the owner of Z can use it because no other users have been granted any authority. The specified text ('This is a test library') is displayed whenever the library description for Z is displayed.

Example 3: Creating a Library in an Independent Auxiliary Storage Pool (ASP)

CRTLIB   LIB(INVENTORY) ASPDEV(SALES)
         TEXT('Inventory Library on SALES ASP')

The library INVENTORY is added to the system in an independent auxiliary storage pool (ASP) named SALES. The SALES ASP must have been activated (by varying on the ASP device) and have a status of 'Available'. The library is a production library; only the owner has object existence (*OBJEXIST) and object management (*OBJMGT) authorities for it. The authority for other users to library INVENTORY is determined by the create authority of library QSYS, since *LIBCRTAUT was assumed for the AUT parameter. The text, 'Inventory Library on SALES ASP', is displayed whenever the library description for INVENTORY is displayed.

Error messages

*ESCAPE Messages

CPFB8ED
Device description &1 not correct for operation.
CPF21A0
*AUDIT required to create or change libraries.
CPF210E
Library &1 not available for reason code &2.
CPF2111
Library &1 already exists.
CPF2122
Storage limit exceeded for user profile &1.
CPF2138
Creation of library &3 not allowed.
CPF2166
Library name &1 not valid.
CPF2172
ASPDEV value not valid with value specified for ASP.
CPF218A
Library &1 cannot be created into ASP &2.
CPF218B
Library &1 cannot be created into ASPDEV &2.
CPF2197
Library &1 cannot be created into user ASP &2.
CPF2283
Authorization list &1 does not exist.
CPF7012
Auxiliary storage pool &4 not found for object &1.
CPF9814
Device &1 not found.
CPF9825
Not authorized to device &1.
CPF9833
*CURASPGRP or *ASPGRPPRI specified and thread has no ASP group.