Set default public authority

When objects are created in a library, the public authority for the object will, by default, be set by using the CRTAUT value of the library.

By specifying the following:

CRTLIB LIB(TESTLIB) CRTAUT(*USE) AUT(*LIBCRTAUT)

The library TESTLIB is created. All objects created into library TESTLIB will, by default, have public authority of *USE. The public authority for library TESTLIB is determined by the CRTAUT value of library QSYS.

By specifying the following:

CRTDTAARA DTAARA(TESTLIB/DTA1) TYPE(*CHAR) +
          AUT(*LIBCRTAUT)
 
CRTDTAARA DTAARA(TESTLIB/DTA2) TYPE(*CHAR) +
          AUT(*EXCLUDE)

Data area DTA1 is created into library TESTLIB. The public authority of DTA1 is *USE based on the CRTAUT value of library TESTLIB.

Data area DTA2 is created into library TESTLIB. The public authority of DTA2 is *EXCLUDE. *EXCLUDE was specified on the AUT parameter of the Create Data Area (CRTDTAARA) command.

An authorization list can also be used to secure an object when it is created into a library.

By specifying the following:

CRTAUTL AUTL(PAYROLL)
CRTLIB  LIB(PAYLIB) CRTAUT(PAYROLL) +
        AUT(*EXCLUDE)

An authorization list called PAYROLL is created. Library PAYLIB is created with the public authority of *EXCLUDE. By default, an object created into library PAYLIB is secured by authorization list PAYROLL.

By specifying the following:

CRTPF FILE(PAYLIB/PAYFILE) +
      AUT(*LIBCRTAUT)
 
CRTPF FILE(PAYLIB/PAYACC) +
      AUT(*CHANGE)

File PAYFILE is created into library PAYLIB. File PAYFILE is secured by authorization list PAYROLL. The public authority of file PAYFILE is set to *AUTL as part of the Create Physical File (CRTPF) command. *AUTL indicates that the public authority for file PAYFILE is taken from the authorization list securing file PAYFILE, which is authorization list PAYROLL.

File PAYACC is created into library PAYLIB. The public authority for file PAYACC is *CHANGE since it was specified on the AUT parameter of the Create Physical File (CRTPF) command.

Note: The *LIBCRTAUT value of the AUT parameter that exists on most CRT commands indicates that the public authority for the object is set to the CRTAUT value of the library that the object is being created into.

The CRTAUT value on the library specifies the default authority for public use of the objects created into the library. These possible values are:

*SYSVAL
The public authority for the object being created is the value specified in system value QCRTAUT
*ALL
All public authorities
*CHANGE
Change authority
*USE
Use authority
*EXCLUDE
Exclude authority
authorization list name
The authorization list secures the object