Enumerating objects in all libraries inside QSYS.LIB

1.1k views Asked by At

There is pretty much exhaustive info about tables (PF including PF-SRC,LF etc) resides in QSYS2.SYSTABLES.

However when it comes to enumerating all objects (e.g. including PGM, SRVPGM,DTAQ,DTAARA and so on) in certain library do the single source of info exists?

I wonder is it possible to query such info without *ALLOBJ privellege granted if there's only need to find out file name and type?

Right now the only thing that comes to mind is to rely on SYSTABLES and enumerate all objects related to PF + LF. Then identify the source these objects was compiled from (if any) and pray that the rest objects was also compiled from these source.

However, this won't help if there was source, say, PGM-only.

Any ideas?

1

There are 1 answers

1
David G On BEST ANSWER

Check out the OBJECT_STATISTICS UDTF.

Find all journals in library MJATST.

SELECT * FROM TABLE (QSYS2.OBJECT_STATISTICS('MJATST ','JRN') ) AS X;

or

SELECT * FROM TABLE (QSYS2.OBJECT_STATISTICS('MJATST ','*JRN') ) AS X ;

Find all journals and journal receivers in library MJATST.

SELECT * FROM TABLE (QSYS2.OBJECT_STATISTICS('MJATST ','JRN JRNRCV') ) AS X;

or

SELECT * FROM TABLE (QSYS2.OBJECT_STATISTICS('MJATST ','*JRN *JRNRCV') ) AS X ;

Find all programs and service programs in library MYLIB. Use *ALLSIMPLE to return the list quickly, omitting the detail information.

SELECT * FROM TABLE (QSYS2.OBJECT_STATISTICS('MYLIB','PGM SRVPGM', '*ALLSIMPLE') ) AS X;