|
Here is the source for a program that we use to analyze queries. Although I don't think it'll give you what you need. It will give you the files contained in a query. What it does is build a source physical file in a library with a member for each *QRYDFN object. The I do a PDM Option 25 over the entire source file looking for specific objects. I'm sure you could write a lookup program if you wish. I just never got around to it. The file QRYFILEWK is just the outfile from the DSPOBJD command. /* */ /**********************************************************************/ /* C O P Y R I G H T - */ /* HANOVER WIRE CLOTH */ /**********************************************************************/ /* DO NOT COPY OR DISTRIBUTE WITH OUT PERMISSION */ /**********************************************************************/ /* */ /* PROGRAM: ANZQRYBLD */ /* PURPOSE: Build work file for query analysis */ /* AUTHOR: Mark Walter */ /* DATE: 06/27/00 */ /* */ /**********************************************************************/ /* *** MODIFICATION LOG *** */ /* NAME/CO. DATE DESCRIPTION */ /* -------------------- -------- --------------------------------- */ /* */ /* */ /**********************************************************************/ /* program to build the analyze query work file(s) */ /* program will create a source physical file in the specified */ /* library then add a member for each query to be analyzed */ /* Utilize PDM option 25 (SCAN) to search the query */ /**********************************************************************/ pgm parm(&lib) dclf file(qgpl/qryfilewk) dcl var(&lib) type(*char) len(10) dcl var(&mbr) type(*Char) len(10) /* put all query definitions into a temporary work file in QGPL */ /* This file has to be there for the program to compile */ dspobjd obj(&lib/*all) objtype(*qrydfn) output(*outfile) + outfile(qgpl/qryfilewk) outmbr(*first *replace) /* does the source physical file exist? */ /* if it doesn't, create it. */ chkobj obj(&lib/qrysource) objtype(*file) monmsg msgid(cpf9801) exec(crtsrcpf file(&lib/qrysource)) /* if it does exist, remove all of the members */ rmvm file(&lib/qrysource) mbr(*all) monmsg msgid(cpf7301) /* file read loop */ read: rcvf rcdfmt(qlidobjd) monmsg msgid(cpf0864) exec(goto cmdlbl(eof)) /* add the member to the source file and retrive the query */ /* definition into the member you just added. */ addpfm file(&lib/qrysource) mbr(&odobnm) rtvqmqry qmqry(&lib/&odobnm) srcfile(&lib/qrysource) + srcmbr(&odobnm) alwqrydfn(*yes) goto cmdlbl(read) eof: endpgm Thanks, Mark Mark D. Walter Senior Programmer/Analyst CCX, Inc. mwalter@xxxxxxxxxx http://www.ccxinc.com "Chuck Lewis" <clewis@xxxxxxxxxx> To: "'Midrange Systems Technical Discussion'" <midrange-l@xxxxxxxxxxxx> Sent by: cc: midrange-l-bounces@m Subject: RE: how to query an *qrydfn idrange.com 06/24/2004 02:51 PM Please respond to Midrange Systems Technical Discussion Peter, That doesn't work for me. I picked a regular ole query and hit enter and got: RTVQMQRY QMQRY(LEEQUERY/DPBINVLOC) SRCFILE(ISSRCEP/QQRYSRC) Object DPBINVLOC in library LEEQUERY not found. EXPORT QUERY command ended due to error. RTVQMQRY command failed. The query is DEFINITELY in that library but this command defines whatever it is looking for as a type *QMQRY (?) Chuck -----Original Message----- From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Peter Vidal Sent: Thursday, June 24, 2004 12:40 PM To: Midrange Systems Technical Discussion Subject: Re: how to query an *qrydfn Do this for each query that you want to analyze: &QRYLIB - Query library name &QRYNAME - *QRYDFN Name &SRCLIB - Source library where you want the query definition to be written to. &SRCFILE - Source physical file member where you want the query definition to be written to. Command: QSYS/RTVQMQRY QMQRY(&QRYLIB/&QRYNAME) SRCFILE(&SRCLIB/&SRCFILE) ALWQRYDFN(*YES) Good luck! Peter Vidal -- This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
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.