AS/400: Check where output file is used as an Input

5 pts.
AS/400 output files
We have a few important queries whose outputs form the basis of several (even hundreds) of other queries and reports. If we wanted to make a change in one of these main ones, is there a simple way to tell which other queries use it for an input? For example:
Query: ABCD2014

Library: Lexample1

Outputs sales data that can be used as an input file in the following:





Library: Lexample2
So if we need to make a change in ABCD2014, all of the queries that hang off it need to be changed as well. Is there a report or a function that can list every instance of where ABCD2014 is used as an input? So we can see a list like the SALES queries above? We thought that it might be possible because when you enter a query and library as an input, the system checks to see that it exists – so if it is able to look backwards to ascertain that ABCD2014 is in Lexample1, can it look forwards to see where the output is used as an input?

Answer Wiki

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

I have not seen a command to do what you are looking for. Depending on how your queries were created (WRKQRY or QM400) your best bet may be to write a program to dump all query definitions to a work file then read through the file to find you references as to where used. It’s messy but I can’t think of an easy way.

Discuss This Question: 5  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.
  • philpl1jb

    There are a number of things that are refered to as Query on the AS/400

    Do you mean .. WRKQRY (qry/400) and RUNQRY ???

    Perhaps this will help,289483,sid3_gci1038164,00.html

    54,090 pointsBadges:
  • azohawk

    There are no simply ways to do this with a native system. There were suggestions posted on pieces to get you started.

    There is a 3rd party product called Pathfinder from Hawkeye Information Systems in Iowa that does exaclty what you are looking for.  If you are doing a large system, it might be worth springing for. (note: I have no affiliation w/ Hawkeye).


    4,075 pointsBadges:
    You can DSPPGMREF over the RPG programs.output to a file and use that file to find the file names. You cn get similar information with an API over the quieries.

    Good Luck
    1,235 pointsBadges:
  • philpl1jb
    The URL I provided yesterday uses RTVQMQRY to get a display of the query 400 output to a file.  It then searchs the file for the file name.
    54,090 pointsBadges:
  • ToddN2000
    As a side note, if you are adding a new field(s) to the main query that crates the output used by all others, you only need to change those that are to use the new field(s). If the new filed/column is not used in the sub queries there is no need to change them.
    136,470 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: