• 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
    ARCAD Software

    [Webinar] Synchronous IBM i and non-IBM i Deployments
    April 13 at 12 p.m. ET

    Do you need to automate and synchronize deployments across ALL your environments and applications?

    Many backend IBM i applications have off-platform components, such as an API layer, or Web front-end. To ensure your application stays reliable, artifacts must be deployed securely and in-sync.

    In our Webinar, learn how to orchestrate all your deployments, multi-platform and multi-cloud, using DROPS by ARCAD Software:

    – One single console to deploy across multiple endpoints – IBM i, Windows, Linux, IBM z, on prem or cloud

    – Real-time visibility of application status, from anywhere

    – Deployment plans and one-click-deploy

    – Rollback on error

    Simplify and secure your application delivery.

    Register Now

    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

    • IBM Tweaks Some Power Systems Prices Down, Others Up
    • Disaster Recovery: From OS/400 V5R3 To IBM i 7.4 In 36 Hours
    • The Disconnect In Modernization Planning And Execution
    • Superior Support: One Of The Reasons You Pay The Power Systems Premium
    • IBM i PTF Guide, Volume 25, Number 13
    • IBM i Has a Future ‘If Kept Up To Date,’ IDC Says
    • When You Need Us, We Are Ready To Do Grunt Work
    • Generative AI: Coming to an ERP Near You
    • Four Hundred Monitor, March 22
    • IBM i PTF Guide, Volume 25, Number 12

    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 © 2023 IT Jungle