James says in his message:
..... "I can see where the *source* is going when I run RTVQMQRY on it. What I
don't get is where the data goes when the CL programs I'm looking at
does a RUNQRY on it (e.g., "RUNQRY QRY(FOO/BAR)") .....
It sounds like when the CL program executes the RUNQRY, the output is
not being found or if the RUNQRY is outputting to a DB file, then printing
the query def is a good idea or just reviewing the output option will show
what's going on.
To add to Buck's input:
On my IBM i References Pages blog on the IBM i Tips page, I have this listed:
Code to convert all WRKQRY's / QMQRY's to SQL.
Note: Create an SQL source physical file to hold each WRKQRY / QMQRY that will
be converted to an SQL source file member. I used SQLLIB for this.
CRTLIB SQLLIB - The library for holding the CLLE / SQL source members.
CRTSRCPF SQLLIB/QSQLSRC RCDLEN (112)
CRTSRCPF SQLLIB/QCLSRC RCDLEN (112)
Add source code below to QCLSRC file in the library of your choosing
or SQLLIB/QCLSRC
CRTDUPOBJ of file QADSPOBJ to file QGPL/QRYLIST so the record format
of the DSPOBJD command works.
Compile the source code.
Program name: QRYREF.
SBMJOB to Call SQLLIB/QRYREF and let run to completion.
Every WRKQRY / QMQRY will be converted to an QSQLSRC member in
library SQLLIB.
Note: I copy and paste the various SQL source members to ACS Run SQL Scripts.
Library/file becomes schema.table in SQL.
/****************************************************/
/* QRYREF */
/****************************************************/
PGM
DCLF FILE(QADSPOBJ)
DSPOBJD OBJ(*ALL/*ALL) OBJTYPE(*QRYDFN *QMQRY) +
OUTPUT(*OUTFILE) OUTFILE(QGPL/QRYLIST)
OVRDBF FILE(QADSPOBJ) TOFILE(QGPL/QRYLIST)
LOOP1:
RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(LOOP2))
RTVQMQRY QMQRY(&ODLBNM/&ODOBNM) +
SRCFILE(SQLLIB/QSQLSRC) ALWQRYDFN(*YES)
GOTO CMDLBL(LOOP1)
LOOP2:
DLTOVR FILE(*ALL)
ENDPGM
/******************************************************/
Respectfully,
Michael Mayer
IBM i on Power System Admin
ERMCO-ECI
2225 Industrial Rd
Dyersburg, Tennessee 38024
Office and OnCall: 731.676.4318
Cell: 518.641.8906
Email: michael.mayer@xxxxxxxxxxxxx<mailto:michael.mayer@xxxxxxxxxxxxx>
https://www.ermco-eci.com<
https://www.ermco-eci.com/>
IBM i Personal Blog:
https://ibmireference.blogspot.com<
https://ibmireference.blogspot.com/>
"Success is not final. Failure is not fatal. It is the courage to continue that counts".
------------------------------
message: 3
date: Thu, 15 Jun 2023 13:17:18 -0400
from: Buck Calabro <kc2hiz@xxxxxxxxx<mailto:kc2hiz@xxxxxxxxx>>
subject: Re: Query Manager Queries
On 6/15/2023 12:51 PM, James H. H. Lampert via MIDRANGE-L wrote:
I'm analyzing some very complex customer code that does a few things I'd
never seen before. Including running Query Manager queries
I found this for extracting the SQL for inspection, using RTVQMQRY:
https://www.rpgpgm.com/2013/08/getting-sql-statement-of-query.html<https://www.rpgpgm.com/2013/08/getting-sql-statement-of-query.html>
but I'm not entirely sure where the data from the query definitions I'm
looking at is actually going.
Can somebody shed some light on this?
The retrieved source goes into the source file that is specified on the
RTVQMQRY command.
--
--buck
http://wiki.midrange.com<
http://wiki.midrange.com>
Your updates make it better!
------------------------------
The information in this email may be confidential. It is intended only for the person(s) named above. If you are not the intended recipient, please notify the sender and do not review, distribute, or duplicate this email.
As an Amazon Associate we earn from qualifying purchases.