Solved

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

Posted on 2008-09-30
5
413 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 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