Hi Rob

*QMQRYs are simply a container for the SQL statement, the rest of it is object-related information. DMPOBJ will show that

*QMFORMs are the presentation object for *QMQRYs. They do not include printer output information. Printer stuff is in the STRQMQRY command and perhaps using overrides. For Query for i, even there the defined output is not always used.

You can retrieve QM objects into source with RTVQMQRY and RTVQMFORM commands - the former will be just the statement - BTW, use RCDLEN 79 for the former, RCDLEN 162 for the latter. QMFORM source is not for the faint of heart - here's an example -

 *************** Beginning of data *****************
 H QM4 05 F 01 E V W E R 01 03 26/02/11 12:16
 V 1001 050 STAFF TABLE FORM
 T 1110 005 004 1114 007 1115 006 1118 003 1113 062
 R BREAK1  2      1   Department
 R BREAK2  2      2   Job
 R         2      3   Name
 R SUM     2      4   Salary
 R         2      5   Commission
 V 1201 001 0
 V 1202 001 2
 T 1210 003 003 1212 004 1213 006 1214 055
 R 1    CENTER Department *&DEPT Staff List
 R 1    LEFT   &DATE
 R 1    RIGHT  &TIME
 V 1301 001 2
 V 1302 001 0
 T 1310 001 003 1312 004 1313 006 1314 055



*Regards*

*Vern Hamberg*

IBM Champion 2025 <cid:part1.yGsSIxZW.sBElI6DC@centurylink.net> CAAC (COMMON Americas Advisory Council) IBM Influencer 2023


On 2/10/2026 6:53 PM, Rob Williams via MIDRANGE-L wrote:
Hi Michael,

Take a look at the following IBM document on extracting information from
*QRYDFN's.

https://www.ibm.com/support/pages/extract-information-qrydfn-object-types

It will allow you to automate the printing of the Query Definition (option 6
from WRKQRY).

You will still need to copy the spooled file to a PF, then query it with SQL
to extract the output type and printer. But that should be a rather simple
task to do in a small program.

It should be much easier than manually placing a '6' by each query in
WRKQRY.,

I'm not sure about *QMQRY's.

Rob W.

-----Original Message-----
From: MIDRANGE-L<midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Michael Mayer via MIDRANGE-L
Sent: Tuesday, February 10, 2026 2:47 PM
To: Midrange Systems Technical Discussion<midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Michael Mayer<michael.mayer@xxxxxxxxxxxxx>
Subject: WRKQRY question ...

Good day all. I happened to run into a developer conversation today about
the WRKQRY command that I found interesting. These guys were trying to
figure out if there was a way to kick out all wrkqry's and QM query's to an
outfile and then be able to run a query over the outfile to show the WRKQRY
printer device.

I ran this and couldn't find it.
DSPOBJD OBJ(QGPL/ECOPENORDS) OBJTYPE(*QRYDFN *QMQRY) DETAIL(*SERVICE)
OUTPUT(*OUTFILE) OUTFILE(QRYLIB/TESTFILE).

My mind went blank trying to figure it out. Maybe an SQL could pull that
info out but I'm not sure what to run.

I see it if I print out a WRKQRY definition - sample below:

Selected output attributes
Output type . . . . . . . . . . . . . . Printer
Form of output . . . . . . . . . . . . Summary only
Line wrapping . . . . . . . . . . . . . No Printer Output
Printer device . . . . . . . . . . . . ABCD1234 *---------
Report size
Length . . . . . . . . . . . . . . . 66 (default)
Width . . . . . . . . . . . . . . . . 132

The IBM i community is amongst the smartest group of creative people I know
of.
Any idea's to jumpstart my brain would be appreciated.
MM


Respectfully,
Michael Mayer
INFOR Junior LN ERP Administrator
IBM i on Power System Admin
ERMCO-ECI
2225 Industrial Rd
Dyersburg, Tennessee 38024
Cell, Office and Text Messages: 518.641.8906
Email:michael.mayer@xxxxxxxxxxxxx<mailto:michael.mayer@xxxxxxxxxxxxx>
https://www.ermco-eci.com<https://www.ermco-eci.com/>
https://ermcopower.com/
IBM i Award Winning Blog Site:
https://ibmireference.blogspot.com<https://ibmireference.blogspot.com/>
Awarded IBM 2024/2025 Advocate, Contributor, Influencer and IBM i Ready
Badges.
[cid:image001.jpg@01DC9AAC.27BC0C40]



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:https://lists.midrange.com/mailman/listinfo/midrange-l
or email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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.