Solved

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

Posted on 2008-09-30
5
420 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
A while back when OPSMGR 2012 was released we were very excited about getting it into our environment and upgrading our 2007 implementation,  we started our planning and we then proceeded with our implementation. All went as planned & our system …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

623 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