Library Information Service
In her latest iCan blog, Dawn May recaps a new IBM i service.
By Dawn May08/19/2020
Simply enter the name of the library and the service will return the attributes of the library; there are several columns of information which are similar to the attributes you can retrieve with RTVLIBD (or the Retrieve Library Information API).
This service makes it extremely easy to review the overall attributes of a library. I really like how easy it is to get the size of the library, including all objects in the library and the size of the library object itself. (Note that RTVLIBD does not return the library size.)
SELECT OBJECT_COUNT,LIBRARY_SIZE,LIBRARY_SIZE_COMPLETE, LIBRARY_TYPE,TEXT_DESCRIPTION FROM TABLE ( QSYS2.LIBRARY_INFO(LIBRARY_NAME => 'DAWNM') );
The simple statement above returns the following:
- The total number of objects in the library
- The library size, which includes the size of all of the objects in the library plus the size of the library object itself
- The “Library size complete” column is an indicator of whether some objects were omitted in the total library size. This is a simple yes/no indicator
- The library type simply tells you whether the library is a PROD or TEST library
- The text description of the library
For completeness, you can get the information about the size of the library in other ways, but this new service makes it very easy.
Probably the most common way to review the size of libraries is using the RTV/PRTDSKINF commands. The advantage of PRTDSKINF is you can get a list of all libraries on the system and their sizes. Of course, you must run a RTVDSKINF first, which can be a long-running operation, but most shops schedule this to be done weekly.
Most of us probably use the DSPLIB command interactively to view contents of the library along with the size of each object in that library. DSPLIB *PRINT gives you a list of all objects in the library, the size of each object, as well as the total size at the end of the spooled file.
QSYS2.Object_Statistics (similar to DSPOBJD)
Using the Object_Statistics service, you can craft an SQL SELECT statement to sum the size of all of the objects in a library. However, this does not include the size of the library object itself.
Dawn May is an IBM i consultant. She owns Dawn May Consulting, LLC in the Greater Boston area. Dawn is a former IBM senior technical staff member.
See more by Dawn May