2

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?

im_infamous
  • 972
  • 1
  • 17
  • 29
  • You do require *OBJOPR access to an object before you can even see that it exists (except via the database catalogue as you mention). I would suggest you ask your IBM i admin to help you with this - maybe they could schedule you a weekly (or whatever) 'all object' extract, so that you could query that. My question here would be, though, what do you actually need to know from a business perspective? Because there are other mechanisms that might be useful, e.g., if you want to know of objects that have changed, there are action auditing options for that. – MandyShaw May 28 '18 at 16:21
  • P.S. Re *OBJOPR, you may be able to see the object listed on its parent library (e.g. via dsplib) without *OBJOPR access to the object, I honestly can't remember and don't have an IBM i system handy to check. – MandyShaw May 28 '18 at 16:51
  • @MandyShaw thank you for your input. business perspective is kinda staightforward - to have and unified point of all business objects in order to monitor namespace for object name intersection (and avoid subsequent replacement on install due to same name). – im_infamous May 29 '18 at 08:00
  • I am confused. Why would you not want to replace an object on installing a new release (I get that you need to be careful with data objects)? All this would normally be taken care of by your change management system, which one are you using? – MandyShaw May 29 '18 at 11:58
  • But if you do need a complete list, suggest scheduling a dspobjd *all *all to an outfile,for the relevant libraries,at a suitable interval and taking access into account as above. – MandyShaw May 29 '18 at 12:01
  • If you mean you don't want to choose an existing name by accident, surely you just need some sort of control store e.g. spreadsheet where developers log the names they've selected? – MandyShaw May 29 '18 at 12:17
  • @MandyShaw kinda got to develop that "spreadsheet" almost from scratch due to precense of large legacy codebase being abandoned for a long time – im_infamous May 30 '18 at 17:03
  • Then I would do a one-off dspobjd *all *all on each of the relevant libraries to do the initial info collection. Ask your IBM i admins for help if you are not sure you have authority to everything. But if people are developing additional code for you, I would suggest it is up to them to suss this out - they are likely to have their own mechanisms/coding conventions which they will need to align with the code base. – MandyShaw May 30 '18 at 17:55
  • @MandyShaw thank you for your insights, will do – im_infamous May 31 '18 at 07:41
  • You might well find the OBJECT_STATISTICS service function easier as in the answer below, it basically does the same thing in a more sql friendly manner (that's assuming you can tell it to list objects of /all/ types in one go, which I do think is a good idea, in case you miss something - you've made no reference to jobd's, sbsd's, outq's, or other work management bits and pieces, for example, any of which may be key to how your application works in practice). – MandyShaw May 31 '18 at 09:01

1 Answers1

3

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;
im_infamous
  • 972
  • 1
  • 17
  • 29
David G
  • 3,940
  • 1
  • 22
  • 30