A library list is similar in concept to the “PATH” in Unix and MS-DOS. It specifies which libraries are to be searched and the order in which they are searched when the system looks for an object. A library list is identified by the value *LIBL. A default library list is automatically created by OS/400 for each job started by a user. Your default library, that is the library that has the same name as that as your user profile, is automatically included in your library list.
Display Library List (DSPLIBL)
You can display your library list by typing DSPLIBL and press on a command line. The following is the library list for the user “YASIRU”.
Note that you may not have all the libraries in the above list. As you can see, a library list is divided into three parts:
- system portion
- which consists of the libraries that are required to run system functions
- current library
- which by default, is the library that has the same name as your user profile (in this case, the library “YASIRU”). The current library is the first user library that is searched before the rest of the user libraries in the list.
- user portion
- which consists of libraries that holds user objects. Some user libraries, such as QTEMP, QGPL, and QGDDM come with the system while others are locally supplied. In addition, the user can create their own libraries and add them to their library list.
If a user does not specify a library name when requesting an operation on an object, the libraries in the library list are searched for the object (starting with the system libraries, the current library, and the user libraries).
For example, assume that the user “YASIRU” has an executable program (*PGM object) called “TESTPROG” in the library “YOURLIB” and user “YASIRU” wants to run the program (using the CALL command) and issues the command CALL TESTPROG.
A message will appear stating that the program is not found in the library list. This is because “YOURLIB” is currently not in the library list. If, however, “TESTPROG” is qualified by “YOURLIB” as CALL YOURLIB/TESTPROG then the program can be found and executed.
Add a Library to Library list
To add a library to the library list, type the “Add Library List Entry” (ADDLIBLE) command, followed by the library name (or prompt on the command) ADDLIBLE YOURLIB.
Edit Library List & Change Current Lib
If “YASIRU” now issues the the unqualified CALL command, the program can now be located and executed since the library that contains the program is now in the library list. You can edit your library list using the EDTLIBL command and remove a library list entry using the RMVLIBLE command. “YOURLIB” can be made the current library by typing CHGCURLIB YOURLIB.
Some commands automatically default to the current library (*CURLIB), such as the CRTSRCPF command. Note, however, that both commands (ADDLIBLE and CHGCURLIB) are only effective for a particular session. Next time, when “YASIRU” signs on, “YOURLIB” will no longer be in their library list and hence, no longer the current library.