The library in the AS400 system is a collection of different types of objects.
QSYS is the system library and is the only available library in as400 that contains other libraries on the as400 system. Any other library other than QSYS cannot contain a library-type object.
The object type for library type object is *LIB.
To create a library use the command CRTLIB.
We can also create the schema using the CREATE SCHEMA SQL statement that creates a library-type object and it differs from the library created using the CRTLIB command. The schema contains a journal and journal receiver by default which is not available in the library. that’s the difference between schema and library.
When you log in QSYS library gets loaded first as it is a root library.
To locate any library in ifs we should qualify it with root library QSYS. /qsys.lib/libname.lib
After login to the as400 system, a session gets created for the user and a temporary library is created in that session which is unique in each session which means that one session qtemp library cannot be accessed by another session or job.
After login to the as400 system, a default library list is set and the user can add libraries to the library list to call the program objects. you can edit the library list using the EDTLIBL command or add the library to the library list using the ADDLIBLE command.
There are four types of library list in as400
System library: The system library is an IBM-supplied library that begins with the letter Q or #. The system library is always present at the top of the library list. A maximum of 15 system libraries can be present on the library list at a time. To display the system libraries in the library list you can run the command DSPSYSVAL SYSVAL(QSYSLIBL) to view the system value QSYSLIBL that contains the default system libraries.
Product library: The product library is added to the library list automatically by the system programs when it is being used and later removed from the library list when the job uses the product library.
Current library: the current library is the work library where all our work is stored. To change the current library use the command CHGCURLIB.
User library: The user library is created by the user using the CRTLIB command or CREATE SCHEMA SQL statement. The user portion of the job can be stored in the job description i.e. JOBD type objects. You can display user libraries in the library list using the system value QUSRLIBL. Run command DSPSYSVAL SYSVAL(QUSRLIBL).
Several commands can be used with the library in as400
DSPLIBL: The display library list command is used to display all types of libraries as part of the library list. For example, system library, current library, user library, etc.
CRTLIB: The create library command is used to create a user library where one has to input the library name, library type, and description and can create a user library. Library type is of two types:
*PROD: When a user library is created using type *PROD means production library then files in the production library cannot be opened for update in debug mode. A user can specify *NO for the UPDPROD parameter (update production files) on the STRDBG command (Start debug) to start with testing. However, this option will not stop the program from being debugged to delete records or update other objects like data areas in the library.
*TEST: When a user library is created using type *TEST means test library. Files can be updated during testing.
DSPLIB: The display library command can be used to get the information of all the objects present in the given library with its size.
EDTLIBL: Edit library list command is used to edit the library list, you can add, remove, or change any library position on the library list.
ADDLIBLE: Add library list entry command to add library on the library list.
WRKLIBPDM: Work with libraries using the PDM command
CHGLIBL: Change library list command can be used to change the library list.
RMVLIBLE: Remove library list entry command can be used to change libraries from the library list.
The library in the AS400 system is a collection of different types of objects.
QSYS
is the system library and is the only available library in as400 that contains other libraries on the as400 system. Any other library other thanQSYS
cannot contain a library-type object.*LIB
.CRTLIB
.CREATE SCHEMA
SQL statement that creates a library-type object and it differs from the library created using theCRTLIB
command. The schema contains a journal and journal receiver by default which is not available in the library. that’s the difference between schema and library.QSYS
library gets loaded first as it is a root library./qsys.lib/libname.lib
EDTLIBL
command or add the library to the library list using the ADDLIBLE command.Q
or#
. The system library is always present at the top of the library list. A maximum of 15 system libraries can be present on the library list at a time. To display the system libraries in the library list you can run the commandDSPSYSVAL SYSVAL(QSYSLIBL)
to view the system valueQSYSLIBL
that contains the default system libraries.CHGCURLIB
.CRTLIB
command orCREATE SCHEMA
SQL statement. The user portion of the job can be stored in the job description i.e.JOBD
type objects. You can display user libraries in the library list using the system valueQUSRLIBL
. Run commandDSPSYSVAL SYSVAL(QUSRLIBL)
.*PROD
means production library then files in the production library cannot be opened for update in debug mode. A user can specify *NO for theUPDPROD
parameter (update production files) on theSTRDBG
command (Start debug) to start with testing. However, this option will not stop the program from being debugged to delete records or update other objects like data areas in the library.*TEST
means test library. Files can be updated during testing.QGPL
is the general-purpose library in AS400.