How can we help you?

We have hundreds of highly-qualified, experienced experts working in 70+ technologies.

IBM i e-Book

A Developer’s Guide to Mastering IBM i Concepts

System Architecture

Libraries and Library List

Understanding the Role of Libraries in IBM i (formerly AS/400) Systems

In IBM i (formerly AS/400), a library is like a digital folder. It’s where you put similar things together, just like you’d organize your files in folders on your computer. These things can be programs, files, and more. Libraries keep everything neat and help you find what you need. When you want to use something, you say where it is by naming the library. So, libraries are like digital organizers that keep the IBM i system tidy and running smoothly.

In the AS/400 system, libraries, often marked as *LIB, are like virtual folders for organizing objects. Actual AS/400 objects aren’t stored inside libraries; libraries simply group objects together. So, it’s more about association than physical location.

Some AS/400 items, such as databases, storage, and programs, can exist in multiple libraries. When a program wants one of these items, it chooses the correct one from the Library List. Special commands can move items between libraries, and you can link items together when building a program to adjust how the Library List behaves when the program is in action.

Libraries cannot contain other libraries:

  • Libraries contain various items. Libraries can’t hold other libraries, except for one special library called QSYS (System provided).
  • AS/400 uses a list-like structure, not like Windows, which has a tree-like setup. To find something on AS/400, you need to know the library and the object’s name. Objects on AS/400 are identified by their qualified name, which looks like LIBRARY/OBJECT. For example, if you want to talk about the Employee file in the Company library, you’d say Company/Employee.
  • Generally speaking, all libraries created by IBM for use by the operating system begin with the letter ‘Q’.

System Library/ IBM Standard Libraries:

In AS/400, a system library is like a top-secret storage place for important stuff that keeps the whole system running smoothly. This secret library contains essential programs, settings, and data. Here are the key points:

  • It’s there by default: System libraries are part of the AS/400 setup, and you can’t easily change them.
  • They’re locked down: Only trusted people can make changes to these libraries to protect the system.Examples: System libraries go by names like QSYS and QSYS2, with QSYS being especially important.
  • They’re in control: These libraries are like the command centre, making sure everything in AS/400 works properly.

So, think of system libraries as the secret backbone that keeps AS/400 going strong.

  • System Libraries:
    • QSYS – System library for the AS/400. It contains the programs and other objects that make up the operating system. QSYS must exist on an AS/400 for the system to work. Other libraries on the AS/400 exist within the context of the QSYS library; it is the only library that can contain other libraries. A few special objects, such as user profiles and I/O configurations, can exist only within QSYS. You should never modify or delete any object within the QSYS library.
    • QSYS2 – System Library for CPI’s.
    • QHLPSYS – Contains on-line help information that is displayed when the Help key or the extended help function keys are pressed.
    • QRECOVERY – Contains objects needed during a recovery procedure.
    • QUSRSYS – The system user data library, contains various IBM-supplied objects needed for system functions as well as user message queues for holding messages.
    • QTCP – TCP Connectivity Utilities.
    • QSPL – holds the spooled, printed output pages that have not yet been printed.
    • QAFP – Advanced Function Printing.
    • QGPL – General Purpose Library that contains IBM-provided objects. The system places newly created objects that are not specifically placed in a distinct library in QGPL.

      Note: It is considered as user defined library.

    • QTEMP – Job specific temporary Library (deleted when the job ends), Each time a user signs on, the system creates a QTEMP library for this interactive job. If the user submits a job to the batch queue, another QTEMP library is created for the batch job.
  • User Libraries:

    In IBM i (formerly AS/400), a user library is a personalized storage area for users. It’s like a digital room where they can put their own programs, files, and things. This way, users can keep their work separate from others and have their own special place for their stuff.

    In many cases, the system administrator sets up user libraries. These are usually created to store the work of individual users. For instance, each programmer might have their personal user library. The administrator can create as many of these user libraries as needed, and the only restriction is the amount of available disk space on the system’s storage device (DASD).

    CUR: The library you’re currently in.

    The current library in IBM i is the first stop for finding objects a user needs. When a user creates objects and designates *CURLIB, those objects are stored in the current library. It’s a user-specific setting, making it easier to locate and access the user’s work. This setup streamlines the process of finding and using objects, providing a convenient way to organize and retrieve resources.

    If the “Limit capabilities” setting in the user profile is set to *YES or *PARTIAL, the user can’t switch their current library.

Library Commands:

  • CRTLIB: (Create Library)

    In IBM i (formerly AS/400), you can make a library by using the ‘CRTLIB’ command.

    Type ‘CRTLIB’ and then the name you want for your library. For instance, if you want to create a library called PIOLIB,’ you’d do this:

    Syntax:

    CRTLIB PIOLIB

    To open the library creation prompt, just type ‘CRTLIB’ on the command line and press F4. Then, provide the library name and a short description.

    Library Type:We can choose ‘Library Type’ above, which can be either *PROD or *TEST, as shown in the CRTLIB screenshot. Let’s now talk about the meaning of each option separately.

    • *PROD:When you make a library with CRTLIB, it’s usually set as a *PROD or production library by default. If it’s a *PROD library, it decides whether you can change or add data in the database files when you’re debugging your program.
      If you set the ‘update production files’ (UPDPROD) parameter to *NO in the Start Debug (STRDBG) command, it means that you cannot modify database files in production libraries during debug mode. They can only be read but not updated.Syntax:

       STRDBG COMMAND
    • *TEST:In Test libraries, you can make changes to all the objects while testing, even if you’ve set UPDPROD to *NO in the Start Debug (STRDBG) command.
  • CHGCURLIB: (Change Current Library)

    The CHGCURLIB command changes the current library in the library list.

    To switch the current library, use the “CHGCURLIB”/” CHGLIBL” command. The sole essential parameter for this command is the name of the library that will become the new current library. Keep in mind that the current library setting only applies to your current session. When you log off and sign in again, the library you set will not persist in your library list. Instead, it will be replaced by the default current library specified in your user profile.

    If you want to review or modify your user profile, you can access it by entering “CHGPRF” and pressing F4. However, if you are new to this system, it’s recommended not to make any changes to your user profile unless you are familiar with the implications of doing so.

    *CRTDFT: No library is the current entry of the library list. If objects are created into the current library, the QGPL library is used as the default.

    Syntax:

    CHGCURLIB CURLIB(PIOLIB)
  • CHGLIB: (Change Library)

    The CHGLIB command is used to modify the type attribute, text description, default create authority value, and default object auditing value of a library.

    The CHGLIB command mandates a single required parameter, LIB, which designates the library to undergo modification. The TYPE, TEXT, and CRTAUT parameters are employed to adjust the respective attributes of the library. As an illustration, to alter the TEXT attribute of PIOLIB, input the command CHGLIB LIB(PIOLIB) TEXT(New Library Description). To confirm that the alteration has been implemented, utilize the Display Library Description command, DSPLIBD, with the command DSPLIBD LIB(PIOLIB).

    Syntax:

    CHGLIB LIB(PIOLIB)
  • CLRLIB: (Clear Library)

    When you clear a library with the Clear Library (CLRLIB) command, you delete objects in the library without deleting the library.

    Syntax:

     CLRLIB LIB(PIOLIB)
  • CPYLIB:

    In IBM i systems (formerly known as AS/400), the ‘CPYLIB’ command serves the purpose of duplicating an entire library, encompassing all of its objects and associated data, to a different library. Here’s how you can utilize the ‘CPYLIB’ command:

    Syntax:

    CPYLIB FROMLIB(source-library) TOLIB(target-library)

    FROMLIB: This parameter designates the source library from which you intend to replicate both objects and data.

    TOLIB: This parameter identifies the destination library where you intend to establish a replica of the source library, encompassing all its objects and data.

    For instance, if your aim is to duplicate all the contents of a library named ‘PIOLIB’ into a fresh library named ‘NEWLIB,’ you can achieve this by issuing the following command:

    Syntax:

    CPYLIB FROMLIB(PIOLIB) TOLIB(NEWLIB)

    This command will replicate all the objects and data found in ‘PIOLIB’ within ‘NEWLIB,’ essentially producing an identical copy of the source library in the destination library.

    Be aware that you must possess the required permissions and authority to execute the ‘CPYLIB’ command. Additionally, it’s important to remember that the command copies all objects and data from the source library to the target library, so exercise caution when using it.

  • DLTLIB: (Delete Library)

    In AS400, there is a command called “DLTLIB” that serves the purpose of removing or erasing a library. Let me guide you through the process of utilizing the DLTLIB command in AS400:
    Enter the DLTLIB command followed by the name of the library you want to delete. For example:

    Syntax:

    DLTLIB PIOLIB

    Note: In this example, replace PIOLIB with the name of the library you want to delete.

    If the library contains objects (such as files, programs, etc.), you will be prompted to delete them as well. Confirm the deletion of the objects if needed.

    Once confirmed, the library and its objects will be deleted.

    Please be cautious when using the DLTLIB command, as it permanently deletes the library and all its contents. Ensure that you have proper authority and backup any important data before using this command. Deleting a library cannot be undone, so make sure you have a backup or no longer need the data within the library.

  • DSPLIB: (Display Library)

    Within the AS400 environment, the DSPLIB command serves the purpose of providing a comprehensive view of a library’s details. To utilize this command effectively, follow these steps:

    • Simply input the DSPLIB command, specifying the name of the library you wish to view.Syntax:
      DSPLIB PIOLIB
    • Replace PIOLIB with the name of the library you want to display information about.
    • The system will provide a detailed list of information about the specified library, including its attributes, object counts, and other relevant details.
    • You can scroll through the information using the page-up and page-down keys or by following the on-screen instructions.

    The DSPLIB command allows you to review information about a library without making any changes to it. This can be useful for verifying the contents and attributes of a library before performing any operations on it.

  • DSPLIBD: (Display Library Description)

    The DSPLIBD command allows you to view comprehensive information about a library. This information encompasses the library’s category, its associated Auxiliary Storage Pool (ASP) number, the ASP device name linked to the library, the default public authority for objects created within the library, the default auditing settings for objects created in the library, as well as a textual description of the library.

    Required Parameter:

    • Library: Indicate the name of the library for which information is being presented.
  • WRKLIB: (Work with Libraries)

    The “WRKLIB” command in AS400 (IBM i) is used to display a list of libraries on the system. This command opens a work library list display that shows the names of libraries on the IBM i server, allowing you to browse and manage library-related tasks. You can use this command to view, create, delete, or perform other library-related operations.

  • EDTLIBL: (Edit Library List)

    The “EDTLIBL” command in AS400 (IBM i) is used to edit the library list. The library list determines the order in which libraries are searched for objects in an AS400 environment. By using the “EDTLIBL” command, you can interactively modify the library list, which can be essential for controlling the search path for programs and objects in your system. This command provides a simple interface to add, remove, or reorder libraries in the library list, giving you control over the environment in which your AS400 applications run.

How can we help you?

We have hundreds of highly-qualified, experienced experts working in 70+ technologies.

share_iconShare
X

Awards and Certifications

company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo