Solved

How can I search all of my Query/400 for an instance of a field name?

Posted on 2008-09-30
5
414 Views
Last Modified: 2013-11-25
I am trying to find a query/400 query on my system.  I want to be able to search all of my queries for and instance of a field name.  I can do it on an RPG program but not on queries.  
0
Comment
Question by:NNeil
5 Comments
 
LVL 37

Expert Comment

by:momi_sabag
ID: 22607719
what do you mean by queries?
do you mean static queries?
if you bind your source program into plans, look up in sysstmts
if you use packages, look in syspackstmt
0
 

Author Comment

by:NNeil
ID: 22607786
I have an AS400 Query/400 queries that I developed and stored in many different query libraries on the AS400.  I would like to search a library for a field name that the query uses.
0
 
LVL 27

Expert Comment

by:tliotta
ID: 22610110
Minor note... Query/400 is not a DB2 function, though I can understand how you chose to ask here. Better would be:

http://www.experts-exchange.com/OS/AS_-_400/

Even better, I think:

http://www.experts-exchange.com/Programming/System/AS_-_400/

Unfortunately, Query/400 use probably should have been discontinued at least 10 years ago. And since Query/400 queries have essentially no source, there is nothing to actually scan. While there are possibilities, they won't be trivial.

Tom
0
 
LVL 33

Accepted Solution

by:
shalomc earned 500 total points
ID: 22613189
it is a pain in the backside, but feasible.

Create a new source file for example YOURLIB/QQRYSRC

Execute the RTVQMQRY command for each and every Query/400 object

If you have PDM, then it is a breeze to create a custom option for this command, to execute if for all *QRYDFN objects, and to search the resulting source members.

If you don't have PDM, well, have fun :p

ShalomC
RTVQMQRY QMQRY(LIBRARY/QRY400NAME) 
         SRCFILE(LIB2/QQRYSRC)      
         ALWQRYDFN(*YES)           

Open in new window

0
 
LVL 27

Expert Comment

by:tliotta
ID: 22617663
One minor note... Shalom has it right. RTVQMQRY is the simplest entry point for the problem. But be aware that it can be misleading in some cases. For example, a field name can appear that is not actually used by the Query/400 object. Unusual, but it happens. A couple other oddities are possible.

As long as it works for your cases, then his answer should get credit. If anything seems incorrect in your results, post back for clarification.

Tom
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question