Use a library list

Using a library list simplifies finding objects on the system.

Each job has a library list associated with it. When a library list is used to find an object, each library in the list is searched in the order of its occurrence in the list until an object of the specified name and type is found. If two or more objects of the same type and name exist in the list, you get the object from the library that appears first in the library list. The following diagram shows the searches made for an object both when the library list (*LIBL) is used and when a library name is specified:

Note: Alternatively, use *NLVLIBL instead of *LIBL to qualify any command. Enter the command from a CL program, on a command line, or anywhere you normally enter a command. The system uses *NLVLIBL to determine which libraries to search for the *CMD object. You search only the national language support libraries in the library list by specifying *NLVLIBL.

This diagram shows the searches made for an object both when the library list (*LIBL) is used and when a library name is specified.
The following diagram shows what happens when two objects of the same name but different types are in the library list. The system will search for CUSTINQ *FILE in the library list by specifying:
DSPOBJD OBJ(*LIBL/CUSTINQ) OBJTYPE(*FILE)

This diagram shows what happens when two objects of the same name but different types are in the library list.

Generally, a library list is more flexible and easier to use than qualified names. More important than the advantage of not entering the library name, is the advantage of performing functions in an application on different data simply by using a different library list without having to change the application. For example, a CL program PGMA updates a data area CHKNBR. If the library name is not specified, the program can update the data area named CHKNBR in different libraries depending on the use of the library list. For example, assume that JOBA and JOBB both call PGMA as shown in the following illustration:


In this illustration assume that JOBA and JOBB both call PGMA. Generally, a library list is more flexible and easier to use than qualified names. More important than the advantage of not entering the library name, is the advantage of performing functions in an application on different data simply by using a different library list without having to change the application. For example, a CL program PGMA updates a data area CHKNBR. If the library name is not specified, the program can update the data area named CHKNBR in different libraries depending on the use of the library list.

However, the use of a qualified name is advantageous in any of the following situations:

If, however, you call a program using a qualified name and the program attempts to open files whose names are not qualified, the files are not opened if they are not in the library list, as shown in the following example:


This example shows you can call a program using a qualified name and the program attempts to open files whose names are not qualified, the files are not opened if they are not in the library list.

The call to PGMA is successful because the program name is qualified on the CALL command. However, when the program attempts to open file ORDENTP, the open operation fails because the file is not in one of the libraries in the library list, and its name is not qualified. If library DISTLIB2 was added to the library list or a qualified file name was used, the program could open the file. Some high-level languages do not allow a qualified file name to be specified. By using an Override (OVRxxx) command, a qualified name can be specified.

Related information
Object signing and signature verification