• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • A Better Way to Get Query/400 Definitions?

    May 31, 2002 Timothy Prickett Morgan

    Hey, Ted:

    I am writing in response to your article, “Print Query Defintions from a Batch Job” that was published in the May 22 issue of Midrange Guru, OS/400 Edition.

    ASC

    A better solution is to use the Retrieve Query Management Query (RTVQMQRY) command, which works fine for a Query/400 definition (*QRYDFN object).

    This puts the output into a source file that can be manipulated with a program.

    See the following example:

    PGM        PARM(&LIBRARY)
    
       DCL        VAR(&LIBRARY) TYPE(*CHAR) LEN(10)
       DCLF       FILE(DSPOBJD)
    
       CLRPFM     FILE(RTVQRYOUT)
       DSPOBJD    OBJ(&LIBRARY/*ALL) +
          OBJTYPE(*QRYDFN) +
          OUTPUT(*OUTFILE) +
          OUTFILE(QTEMP/DSPOBJD)
       OVRDBF     FILE(QTXTSRC) +
          TOFILE(QGPL/QTXTSRC) +
          MBR(RTVQRYTMP)
    LOOP:
       RCVF       RCDFMT(QLIDOBJD)
       MONMSG     MSGID(CPF0864) +
          EXEC(GOTO CMDLBL(ENDLOOP))
       RTVQMQRY   QMQRY(&ODLBNM/&ODOBNM) +
          SRCFILE(QGPL/QTXTSRC) +
          SRCMBR(RTVQRYTMP) ALWQRYDFN(*YES)
       CALL       PGM(RTVQRY1) PARM(&ODOBNM)
       GOTO LOOP
    ENDLOOP:
       ENDPGM
    

    This is what I use. I wrote the RTVQRY1 program to read the QTXTSRC file
    which uses my rtvqryout file for my specific output.

    — Jay

    Thanks for the email. Your code gets the SQL statement that generates the query, preceded by some Query Management definition codes. It does not get the definition you get when you use option 6 of the Work with Queries (WRKQRY) command. What you’re doing is good and useful, but it’s not the same thing that I published.

    — Ted

    Sponsored By
    Advanced Systems Concepts

    SEQUEL meets all your iSeries and AS/400 data access needs in a single, integrated solution:

    • Windows, Web or host user interfaces

  • Convert AS/400 data into PC file formats
  • E-mail or FTP query results, reports and spool files
  • Run-time prompted queries and reports for end users
  • IF-THEN-ELSE logic in queries and reports
  • Report, form and label formatting second to none
  • Easily convert date fields, character-to-numeric, numeric-to-character and other data manipulation
  • SORT or JOIN using a calculated field
  • Quick summarization of data with Tabling function
  • Run multiple SEQUEL requests as one with the SEQUEL Scripting function
  • OLAP Business Intelligence at a fraction of the cost of comparable solutions
  • Take 6 minutes to
    view a SEQUEL ViewPoint ScreenCam movie to see how simple Windows-based
    AS/400 and iSeries data access can be! In just a few short minutes, you
    can find out ways to make your job easier and improve data access throughout
    your organization. Download
    the ViewPoint movie here
    .

    For more information or a FREE trial of SEQUEL,
    call 847/605-1311 or visit Advanced Systems Concepts .

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: mgo_rc, Volume 2, Number 42 -- May 31, 2002

    Sponsored by
    Maxava

    Migrate IBM i with Confidence

    Tired of costly and risky migrations? Maxava Migrate Live minimizes disruption with seamless transitions. Upgrading to Power10 or cloud hosted system, Maxava has you covered!

    Learn More

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Prevent Someone Else from Peeking at Your Window 2000/XP System Proper Use of QTEMP

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 42

This Issue Sponsored By

    Table of Contents

    • A Better Way to Get Query/400 Definitions?
    • Odds and Ends
    • Using Library Lists for JDBC File Access

    Content archive

    • The Four Hundred
    • Four Hundred Stuff
    • Four Hundred Guru

    Recent Posts

    • POWERUp 2025 –Your Source For IBM i 7.6 Information
    • Maxava Consulting Services Does More Than HA/DR Project Management – A Lot More
    • Guru: Creating An SQL Stored Procedure That Returns A Result Set
    • As I See It: At Any Cost
    • IBM i PTF Guide, Volume 27, Number 19
    • IBM Unveils Manzan, A New Open Source Event Monitor For IBM i
    • Say Goodbye To Downtime: Update Your Database Without Taking Your Business Offline
    • i-Rays Brings Observability To IBM i Performance Problems
    • Another Non-TR “Technology Refresh” Happens With IBM i TR6
    • IBM i PTF Guide, Volume 27, Number 18

    Subscribe

    To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

    Pages

    • About Us
    • Contact
    • Contributors
    • Four Hundred Monitor
    • IBM i PTF Guide
    • Media Kit
    • Subscribe

    Search

    Copyright © 2025 IT Jungle