Our auditors needed to verify the retired object were not in any production libraries. There may be a better way to do this, but this was my approach. I found the data I needed for the list in ACMSCTL.PRTINS. I tried using QSYS2.OBJECT_STATISTICS, but that took too long since I had to use *ALL as the library. I nosed around for the best command line option and settled on DSPOBJD. With QSYS2.QCMDEXC, I was easily able to build the DSPOBJD command from the SQL.
This approach works fine for the system where PRTINS resides. For the production system, I needed to take the list from the first SQL and load that as the list of objects for the second SQL. Either way, I can query the same work file to get a list for the auditors. Once I have the list of all libraries for all objects, I could use QSYS2.OBJECT_STATISTICS at this point to document last use date, source date and any other values as needed for audit purposes.
Clear the work file.
drop table if exists MYLIB.DSPOBJD;
Load the work file from PRTINS using DSPOBJD.select substr(PRTNMK,1,10) Object,PRTFMLYNM Type,date(LSTACTTS) Last_Action_Date, QSYS2.QCMDEXC('DSPOBJD OBJ(*ALLUSR/' CONCAT Trim(PRTNMK) CONCAT ') OBJTYPE(*ALL) OUTPUT(*OUTFILE) OUTFILE(MYLIB/DSPOBJD) OUTMBR(*FIRST *ADD)') From ACMSCTL.PRTINS where RETIRED = '1' ;
Load the work file from Object List using DSPOBJD.
With ObjList(RetObj) as (values ('PMIPPAYF'), ('PGMX817F'), ('PGMX917D'), ('PGMX919D'))
select RetObj, QSYS2.QCMDEXC( 'DSPOBJD OBJ(*ALLUSR/' CONCAT Trim(RetObj) CONCAT ') OBJTYPE(*ALL) OUTPUT(*OUTFILE) OUTFILE(MYLIB/DSPOBJD) OUTMBR(*FIRST *ADD)')
From objList;
Query the work file using DSPOBJD.select ODOBNM, ODLBNM, ODOBTP, ODOBAT From MYLIB.DSPOBJD;
------------------------------
David Taylor
Senior Developer
Range Resources Corporation
Fort Worth TX US
------------------------------