Warning: Undefined array key "id" in /home/nicklit/www/www/wp-content/plugins/seo-by-rank-math/includes/opengraph/class-image.php on line 130

IBM i Libraries and Objects

What is the difference between a Libraries and Objects?

  • Everything on the IBM i System is an object.
  • Objects are collected together within libraries.

In simple terms, think of a library as a folder on your PC and an object as the file within that folder.

On the IBM i system, objects are grouped in libraries. The library itself is also an called an object. Objects are identified by name type. Libraries have an object type *LIB. Programs have an object type *PGM.

An Object Type denotes the purpose of an object and how it is used on the system

Objects always live in a *LIBRARY

Whenever an object is created, it goes into a library.

An object in IBM i (former AS400). An object is a named unit that exists (occupies space) in storage, and on which operations are performed by the operating system. IBM® i objects provide the means through which all data processing information is stored and processed by the IBM i operating system.

IBM Knowledge Center

Libraries do not actually contain the objects themselves, just a catalog of where those objects exist in storage, an address pointer to the object itself.

An Object can only exist in one library only.

Objects can be duplicated into other libraries.

Again, think of this like copying a file from one folder on your PC into another. To open a specific file in a folder you would go to that folder and double click it. In IBM I terms, you would do the same thing by going to a library and opening the object.

How do we find an object?

We can either reference an object by qualifying its library name - for example executing a program name and qualifying the library it is in. Executing program(PGMA) in library(LIB1) would use the CALL(*CMD) and look like this:

CALL LIB1/PGMA

Lets look at some library and Object structures:

Some Common Object Types

*LIBL - Library

*CMD - Commands

*PGM - Program

*MODULE - Modules

*SRVPGM - Service Program

*DTAARA - Data Area

*FILE - Files come in different shapes and sizes and can have different attributes like data, display, printer, communication. These types are called *attributes

Library Types

Loosely speaking, we have two main types of library:

*SYSTEM - system libraries, supplied by IBM, that define the operating system and system storage. These contain software products, licensed programs and even general purpose libraries for us to use.

*USER - user libraries created by use developers

Whenever we sign into the IBM i system our session (called a JOB) includes a list of various libraries that we can see by default. We can add and remove libraries to that list.

This is called the job library list.

DSPLIBL - Display Library List

IBM i Libraries and Objects 1

This is a very important concept because you must understand that looking for something on the system will typically start with saying something like "show me this file data". If you do not tell the system a specific library to look for it will, by default, look through your jobs library list to find the first occurrence of that file and display the data:

So, if objects always live in Libraries, then what types of Libraries are there?

*ALL - All libraries on the system, including QSYS and QTEMP.
*ALLUSR - All non-system libraries, including all user libraries. The libraries are listed alphabetically by library name.
*CURLIB - the current library for the job. If you have not specified a current library for the job, library QGPL is assumed.
*USRLIBL - libraries in the user portion of the job's library list.
*LIBL - libraries in the job's library list.

system library holds objects necessary for the operation of the IBM i system. The primary system library is QSYS, which contains objects that are part of the operating system.  The QHLPSYS library contains objects that provide system help information. The QRECOVERY library contains objects needed during a recovery procedure. The system user data library, QUSRSYS, contains various IBM-supplied objects needed for system functions as well as user message queues for holding messages.

User libraries are used by application programs to perform their functions. By default, the IBM i has the user libraries QGPL and QTEMP. The QGPL user library is a general purpose library that contains objects such as JOBQOUTQ, and MSGQ. The QTEMP library contains temporary objects used during the execution of jobs.

Time to Play with some objects and files:

Click to play

Make sense?

Let's recap -- To display a list of objects within a library, we use the Display Library command, DSPLIB. The Display Library command presents us with a list of OBJECTS and gives the type, the size, and a basic description of each object.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
Pen
>