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:
DSPOBJD OBJ(*LIBL/CUSTINQ) OBJTYPE(*FILE)
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:
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:
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.