Search in QRYDFN

2505 pts.
Tags:
*QRYDFN
AS/400
AS/400 Query
I am looking for an utility which will search for the sources of QRYDFN and tell me which query is using the string that I am looking for.

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 6  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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    *QRYDFN objects don't have source, so there's no "source" to search. If you run WRKQRY and then prompt for a list of *QRYDFNs in a library, you can send each definition to a spooled file. You might then scan each spooled file to find some string. . Other types of queries do have source, e.g., *QMQRYs. . This is probably the single biggest reason that *QRYDFNs should have been converted to *QMQRYs at least 20 years ago. . Tom
    125,585 pointsBadges:
    report
  • RamvishakRamesh
    Yes, I know query defenition has no source. Is there any way I can get the SQL out of the WRKQRY and store it somewhere and then search there?
    2,505 pointsBadges:
    report
  • TomLiotta
    There is no SQL in *QRYDFNs. However, the basic query structure can be converted to SQL as far as it goes. The RTVQMQRY is intended to retrieve *QMQRY source, but it's capable of using a *QRYDFN object as input:
    RTVQMQRY QMQRY(TSTRTVQRY) SRCFILE(QQMQRYSRC) ALWQRYDFN(*ONLY)
    That command would generate the basic source for a *QMQRY into a source file named QQMQRYSRC. It would actually use a *QRYDFN object named TSTRTVQRY, the same name would be used for the resulting member.
    .
    There are numerous potential problems because files can be overridden for *QRYDFNS, or they can be specified at run-time using the RUNQRY QRYFILE() parameter. Also, a big part of the *QRYDFN is report formatting and other details that are directly related to SQL. And some elements of a *QRYDFN object don't translate to SQL at all.
    .
    Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Typo: "...and other details that are NOT directly related to SQL." . Tom
    125,585 pointsBadges:
    report
  • RamvishakRamesh
    I am developing a search utility which will search in the QryDfn. Step 1. I have used DspobjD to get a list of all QryDfn obj. Step2. If I can read each object name and print the *QRYDFN, Step3. I can copy the spool fiel to a DB and Step4. can perform a search in that database for the file that I am searching. But am stuck with Step2. How to print the QryDfn. As you suggested, If i go for a RtvQMQRY, I cannot get the basic query structure of 'ALL' QMQRY into a database file right? I am looking for a utility. If I give the file I have to search for and the library, it should display back the list of QRYDFN which uses the file.
    2,505 pointsBadges:
    report
  • TomLiotta
    You could do it much easier by copying the results of each RTVQMQRY to a database file instead of copying each *QRYDFN spooled file to a database file. That's especially true because of the difficulty in creating a utility that will print each *QRYDFN. The *QRYDFN can only be printed interactively, one at a time. . With a lot of work, you could create one or two emulator macros that could help with the printing, but it won't be easy. Your list from DSPOBJD won't be much help for any macro. There is no additional help. It simply isn't worth doing. . Tom
    125,585 pointsBadges:
    report

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following