On 19 Dec 2012 16:42, Darryl Freinkel wrote:
I have a need to list all objects on a system daily.
DSPOBJD *ALL/*ALL *ALL
to an *outfile takes too long.

I will need the creation and change dates and size.

Is there another way to achieve this?


If "all objects" is sufficiently defined by what is available in that DSPOBJD request, then the speed can be improved using parallel requests. Ages ago when only /QSYS.LIB objects were of interest to me, I had used a CLP which submitted jobs for each library to a somewhat throttled job queue. The CLP gets a list of libraries using a DSPOBJD QSYS/*ALL *LIB *FULL OUTPUT(*OUTFILE) and then did a RCVF against the output file doing something like SBMJOB CMD(DSPOBJD &ODOBNM/*ALL ...) or SBMJOB CMD(CALL PGM(ObjDbyLib) PARM(&ODOBNM)) for each record [while the &ODOBTP *EQ '*LIB' because the same OUTFILE() is being used in all of the concurrent requests]. The biggest issue is ensuring all of the jobs complete without error and if desirable, also are awaited batch job completion to allow for a synchronous operation of the submitter.

Since the database can effect parallel processing and allows an external program to be called, another option is to have a SELECT of the data from the DSPOBJD of the OBJTYPE(*LIB) whereby a scalar UDF lists the objects. Something like the following for example:

setup:
dspobjd qsys/*all *lib *full output(*outfile) outfile(qtemp/od)
crtdupobj od qtemp *file *curlib data(*yes)
chgpf *curlib/od size(*nomax)

create function dspobjd
( libname varchar(10)
)
returns char
language sql
not deterministic modifies sql data
external action returns null on null input
allow parallel
set option dbgview=*SOURCE
begin /* note: no error handling */
declare cmdstr varchar(300);
set cmdstr = 'dspobjd ' concat rtrim(libname)
concat '/*all *all output(*outfile) '
concat 'outfile(*curlib/od) outmbr(*n *add)';
call execcmd(cmdstr); /* Proc invokes QCMDEXC */
return '1';
end

Activate output; e.g. the following SELECT:
create table qtemp/genObjDesc as
( select dspobjd(odobnm), odobnm from qtemp/od )
; -- as a report, but use in insert or create stmt:
....+....1....+....2....+....3
DSPOBJD ( ODOBNM ) Object
1 LIB1
1 LIB2
******** End of data ********

Output would be the list of libraries from the DATA(*YES) duplicated from the original DSPOBJD into the QTEMP/OD, then a record for each object added to the OUTFILE(*CURLIB/OD) as generated by the DSPOBJD LibName/*ALL *ALL *FULL request... which if the database SQL is allowed to, can run parallel. Of course each DSPOBJD requests would effect\log the diagnostic CPD000D rc2 "Command *LIBL/DSPOBJD not safe for a multithreaded job."


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.