× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Retreive QRYDFN info
  • From: Jromeh@xxxxxxx
  • Date: Thu, 13 Nov 1997 09:17:56 -0500 (EST)

Hopefully better late than never <g>...

>>>Does anyone know if there is an API that I can use to retrieve the files
>>>that are going to be used in a QRYDFN.  We are going to be moving some
>>>files from one library to another.  I would like to write a program that
>>>generate a list of all the queries that use those files.

>>You can do a RTVQRYDFN (If that CMD is wrong,  use the GO CMDRTV
>>and look for something similar)   and one of the parameters 
>>(use F10 I think) you can say *ONLYDFN or something like that 
>>(I'm off the machine right now.)

>>The output goes to a source file member.  It gives you the SQL statement
>>which has the file & library name.   

>>You could write a program to look at it and parse it to find what you
>>need.

Use RTVQMQRY with ALWQRYDFN(*YES) to a QQMQRYSRC file (odd length, 
believe 91, check command help) to get the QM SQL statement. Do this for 
each *QRYDFN, then use PDM's 25=Find string option to find the ones with 
your file. 

Also, but perhaps not for your need, do RTVQMQRY with ALWQRYDFN(*YES) to 
QQMFORMSRC to get the QM form source. Make changes in the source, use 
CRTQMQRY and CRTQMFORM to create objects of types *QMQRY and *QMFORM, and 
run these in a CL with the STRQMQRY command. 

In the source, add string substitution variables (&varname) to soften 
libraries, selection parms, or whatever. On the STRQMQRY, use the SETVAR 
parm to pass string values into the SQL statement.

Don't need the QM program product to do this. It allows direct editing of 
*QMQRYs and 
*QMFORMs, but the QMQRY source is pretty easy to handle. QMFORM is 
another matter, so get the columns right in the QRYDFN when working 
without the product.  

Created a CVTQRY command for a client, it does:
     RTVQMQRY &qrydfn -> qtemp/qqmqrysrc
     RTVQMQRY &qrydfn -> qtemp/qqmformsrc
     CRTQMQRY &qrydfn
     CRTQMFORM &qrydfn

This is used to convert user and project leader queries into QMs so they 
can have soft selection parms added. A prompt program is added and then 
they get put on the menu, keeping another "real" report from being 
written.

Also, performance gains can be made by only passing in parts of the WHERE 
clause that have an effect. Saying WHERE <condition1> and field2 BETWEEN 
'          ' AND '9999999999' will cause QQQUERY to build a missing 
selection path for field2, as there _could_ be hex values below ' ' or 
above '9's, though they won't exist. Changing the CL so it only passes 
the field2 clause when values other than ' ' - '9's are selected keeps 
this from being done when not needed.

>Is there also a WRKQRYDFN where on can easily change library/file
>references? In a Y2K project I have all of the new file descriptions, with
>new date fields, in a new library.  Now I see this nightmare of plodding
>through hundreds of inquiries, one at a time, changing the library name.

Don't know of a WRKQRYDFN, but perhaps this could be done using an 
adaptation of the QM techniques described above? At least you wouldn't 
have to wade through all of Query/400's menus. Let me know if you'd like 
help with this approach, will attempt to reply quickly <g>.


Jerome Hughes                     jromeh@aol.com
InterPro Consulting Services      www.interproinc.com
Rosemont, IL USA                  these are my own opinions only

OMNI User Communications Dir.     www.omniuser.org

"Remember, I started this company in my parent's garage." Steve Jobs


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MAJORDOMO@midrange.com
|    and specify 'unsubscribe MIDRANGE-L' in the body of your message.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.