I have always wanted the best way to identify which libraries, on the IBM i partition I was using, belong to IBM. I had come up with doing things like considering all libraries that start with "Q", "SYS", and "#". But that was never a guarantee to separate IBM's from others' libraries.
IBM gave me a way to identify their libraries, using the SQL OBJECT_STATISTICS table function. It allowed me to identify most of the IBM libraries, but not all. I have made some additions to what they told me to make it mostly work.
I need to use three columns from OBJECT_STATISTIC results:
- OBJNAME: Name of the returned object, which in this case will be a library
- OBJDEFINER: User profile who created the object
- OBJNAME: User profile that owns the object
IBM told me that any libraries created by the profiles QLPINSTALL and *IBM would allow me to identify what should be considered IBM libraries. On further investigation on several IBM i partitions I have found what I would also consider to be IBM libraries that were created by the user profile QSYS, or are owned by QSYS.
The statement I came up with is:



