Matthew Roessner
asked on
List all Libraries and number of objects for each library
Does anyone have a SQL statement that will list all libraries on my IBM i server and the number of objects in each of the libraries?
So my output would have just 2 columns. Table Name and Number of Objects.
I appreciate any help...
So my output would have just 2 columns. Table Name and Number of Objects.
I appreciate any help...
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
BTW,
You can limit the output (and runtime) by replacing the library parameter by *ALLUSR
QSYS2.OBJECT_STATISTICS('* ALLUSR','* ALL')
You can limit the output (and runtime) by replacing the library parameter by *ALLUSR
QSYS2.OBJECT_STATISTICS('*
ASKER
The exact statement I actually ran was:
SELECT OBJLO00002 "LIBRARY", count(1) "NUMBER OF OBJECTS"
FROM TABLE (QSYS2.OBJECT_STATISTICS(' *ALLUSR',' *ALL')) AS X
GROUP BY OBJLO00002
ORDER BY OBJLO00002
Thanks for all your help guys!
SELECT OBJLO00002 "LIBRARY", count(1) "NUMBER OF OBJECTS"
FROM TABLE (QSYS2.OBJECT_STATISTICS('
GROUP BY OBJLO00002
ORDER BY OBJLO00002
Thanks for all your help guys!
ASKER
Your statement returns an error - like all the ones I have tried! I am able to return the number of items in a library if I use the following:
SELECT COUNT(OBJNAME) NUMBER_OF_OBJECTS FROM TABLE(QSYS2.OBJECT_STATIST
But I want to ultimately have a statement I can run that will give me the library name and how many objects are in it.
Seems like this is an easy thing that shouldn't be this hard...