A library is an object that is used to group related objects, and to find objects by name when they are used. Thus, a library is a directory to a group of objects.
You can use libraries to group the objects into any meaningful collection. For example, you can group objects according to security requirements, backup requirements, or processing requirements. The amount of available disk storage limits the number of objects that a library can contain, and the number of libraries on the system.
The object grouping performed by libraries is a logical grouping. When a library is created, you can specify into which user auxiliary storage pool (ASP) or independent auxiliary storage pool (independent disk pool) the library should be created. All objects created into the library are created into the same ASP as the library. Objects in a library are not necessarily physically adjacent to each other. The size of a library, or of any other object, is not restricted by the amount of adjacent space available in storage. The system finds the necessary storage for objects as they are stored in the system.
Most types of objects are placed in a library when they are created. The AUT parameter on CRTLIB defines the public authority of the library. The CRTAUT parameter specifies the default authority for objects that are created into the library. If the command creating the object specifies *LIBCRTAUT for the AUT parameter, the object's public authority is the create authority that was specified for the library. You can move most object types from one library to another, but a single object cannot be in more than one library at the same time. When you move an object to a different library, the object is not moved in storage. You now locate the object through the new library. You can also rename and copy most object types from one library into another.
A library name can be used to provide another level of identification to the name of an object. As described earlier, an object is identified by its name and its type. The name of the library further qualifies the object name. The combination of an object name and the library name is called the qualified name of the object. The qualified name tells the system the name of the object and the library it is in.
The following diagram shows two libraries and the qualified names of the objects in them:
Two objects with the same name and type can exist in different libraries. Two different objects with the same name cannot exist in the same library unless their object types differ. This design allows a program that refers to objects by name to work with different objects (objects with the same name but stored in different libraries) in successive runs of the program without changing the program itself. Also, a workstation user who is creating a new object does not need to be concerned about names used for objects in other libraries. For example, in the following diagram, a new file named MONTHUPD (monthly update) could be added to the library OELIB, but not to the library ACCTLIB. The creation of the file into ACCTLIB would fail because another object named MONTHUPD and of type file already exists in library ACCTLIB.
An object is identified within a library by the object name and type. Many CL commands apply only to a single object type, so the object type does not have to be explicitly identified. For those commands that apply to many object types, the object type must be explicitly identified.
Objects that use the integrated file system are located in directories and can be found by using path names or object name patterns instead of searching libraries. You can also use these directories to locate objects.