How to retrieve an outfile in QMQRY?

15 pts.
Tags:
AS/400
QMQRY
WRKQRY
I am working at new place where they have a lot of Queries which works as series one after another, doing selection, writing to outfile. Then next query uses this previous' query outfile, join with something writes to the next outfile etc. To analyze this numerous queries, I used RTVQMQRY command to create a Source to learn how the QUERIES work (what is an Input file, what is Outfile, what is the selection etc.) But this retrieved source consists only SELECT Statement without mentioning Outfile name. Actually, the query makes select and insert to Outfile, but the source that I retrieve, doesn't have this Insert Statement. Is it exist any way to know OUTFILE without going to WRKQRY, display the query, going to option 3, etc?

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • CharlieBrowne

    Since your Queries are going to an outfile, just add this to the runqry statement:  PRTDFN(*YES)

    This will print the information you need.

    62,340 pointsBadges:
    report
  • EstherN
    Thank you very much!!  I changed all runqry statements  with  PRTDFN(*YES)
    and now I can see an outfile name and everything inside printer file.
    Also , at wrkqry  screen I  found that there is an option 6 that prints everything about this query in one printer file  for documentation.   Thank you a lot! 
    15 pointsBadges:
    report
  • ToddN2000
    I am running into an issue as well. We have hundreds of WRKQRY's.  When we upgrade our software package it has a new library name with the new version number at the end. Example  DATALIB01 to the new DATALIB02. IT takes a long time to manually change all of these. I wrote a CL to convert all of them to QMQRY but the ones we have that send the selected data to an output file do not show any output file in the text retrieved using the RTVQMQRY command.  I tried what Charlie suggested and changed the parameter in the WRKQRY to PRTDNF(*YES) , ran the query and did another RTVQMQRY and still only shows the select with not output.. We were hoping that by having all of them converted we could do a find/replace of the library and be done in much less time.

    Here is my code
                  PGM                                                  
                                                                      
                 DCLF       FILE(MYLIB/TEMPQM)                       
                 DCL        VAR(&QRY) TYPE(*CHAR) LEN(10)             
                 DCL        VAR(&LIB) TYPE(*CHAR) LEN(10)             
                 DCL        VAR(&SRC) TYPE(*CHAR) LEN(10)             
                                                                      
                 DSPOBJD    OBJ(MYLIB/*ALL) OBJTYPE(*QRYDFN) +       
                              OUTPUT(*OUTFILE) OUTFILE(MYLIB/TEMPQM) 
                                                                      
                 CHGVAR     VAR(&SRC) VALUE('QQMQRYSRC')              
                                                                      
    LOOP:        RCVF                                                 
                 MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(ENDJOB))  
                                                                      
                 CHGVAR     VAR(&QRY) VALUE(&ODOBNM)                  
                 CHGVAR     VAR(&LIB) VALUE(&ODLBNM)  
                                                                    
                 RTVQMQRY   QMQRY(&LIB/&QRY) SRCFILE(&LIB/&SRC) +   
                              SRCMBR(&QRY) ALWQRYDFN(*YES)          
                                                                    
                 MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(ENDJOB))
                                                                    
                 GOTO       CMDLBL(LOOP)                            
                                                                    
    ENDJOB:      ENDPGM
    107,745 pointsBadges:
    report
  • BigKat
    @ToddN2000

    Do you have access to TaaTools on your system? see QRYUSE tool
    9,170 pointsBadges:
    report
  • ToddN2000
    @BIgKat:
    Thanks for the tip... I'll check with the operations department to see if it 's there. Currently I cannot verify as I have limited authority in my new position. I was hoping to help my old team out of a tedious problem that happens about every 18 months or so.
    107,745 pointsBadges:
    report
  • TheRealRaven
    Since QM queries don't have "outfiles", there is no method to retrieve them even if a *QRYDFN is used as input. And since a *QRYDFN can have the outfile supplied at run-time, there is no reliable method for them. The WRKQRY definition might or might not specify the correct "outfile". Each RUNQRY must be verified.

    Try DMPOBJ. Search the spooled text for "*FILE" and check the lines above it to see if a file is given. One or more input files may listed first, followed by any hard-coded outfile.
    26,510 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: