Query Xref to file

120 pts.
AS/400 Query
The other day I added a field to the DDS of a file. I recompiled all of the RPG programs and display files that use the physical file. But I got burned when I found that I neglected to include all of the queries that used the file. Is there a way to query all of the query definitions to find if my file is anywhere in a query400?

Answer Wiki

Thanks. We'll let you know when a new response is added.


You could use RTVQMQRY against each of your queries to create QM source members, then search through the source members. You could write a small CL program to get a list of all *QRYDFN’s, read the list and retrieve the source for each of them.

This is no guarantee that you will find everything, as the file name can be specified for the query at run time (from a command line or program), or possibly modified by using OVRDBF – and these file names maybe stored in a data area or physical file for example.


Martin Gilbert.

There’s a utility called RTVQRYF that uses MI code to extract details of files used in query objects.
I downlaoded it years’ ago from (I think) the News/400 website. It works a treat on v5.4, but we’re not yet at v6.1 so I don’t know if it works on that release as well.

Good luck
Jeremy Sellick

Discuss This Question: 3  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.
  • kitvb1
    There is an open source utitlity called Xref which you can find at www.code400.com (soon also to be posted at www.support.changefit.com). This manages to list many of the references (result appears to be dependent on O/S version). It is currently being extended and re-branded as XRefIT. XRefIT will remain free albeit no longer open source. Regards Kit
    65 pointsBadges:
  • Satsho
    I second the RTVQRYF utility. It is simple and useful to everyone. We are at V5R4 moving soon to V6R1, so I am keeping my fingers crossed
    1,245 pointsBadges:
  • Sloopy
    If you are at security level 40, the MI utility RTVQRYF won't work. I do have a utility that does the same thing but will run at the highest security level - please email me if you want the code. See https://itknowledgeexchange.techtarget.com/itanswers/identifying-output-files-in-query-definitions/ for more information on query data retrieval. My email is john.blenkinsop@ne.nykline.com Sloopy
    2,195 pointsBadges:

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.


Share this item with your network: