Using libraries

A library is an object used to group related objects and to find objects by name. Thus, a library is a directory to a group of objects.

You can use libraries to perform the following tasks:

  • Group certain objects for individual users. This helps you manage the objects on your system. For example, you might place all the files that a user JOE can use in a library JOELIB.
  • Group all objects used for an individual application. For example, you might place all your order entry files and programs into an order entry library DISTLIB. You need only add one library to the library list to ensure that all your order entry files and programs are in the list. This is advantageous if you do not want to specify a library name every time you use an order entry file or program.
  • Ensure security. For example, you can specify which users have authority to use the library and what they are allowed to do with the library.
  • Simplify security by having automatic authorization list and public authority assignment for newly created objects based on the CRTAUT parameter value of the library. Auditing attributes for newly created objects can be set based on the Create Object Auditing (CRTOBJAUD) parameter value.
  • Simplify save/restore operations by grouping objects that are saved and restored at the same time into the same library. You can use a Save Library (SAVLIB) command instead of saving objects individually using the Save Object (SAVOBJ) command.
  • Use multiple libraries for testing.
  • Use multiple production libraries. For example, you can use one production library for source files and for the creation of objects, one for the application programs and files, one for objects that are infrequently saved, and one for objects that are frequently saved.

Multiple libraries make it easier to use objects. For example, you can have two files with the same name but in different libraries so that one can be used for testing and the other for normal processing. As long as you do not specify the library name in your program, the file name in the program does not have to be changed for testing or normal processing. You control which library is used by using the library list. (Objects of the same type can have the same names only if they are in different libraries.)

The two types of libraries are production and test. A production library is for normal processing. In debug mode, you can protect database files in production libraries from being updated. While in debug mode, any files in test libraries can be updated without any unique specifications.