Short answer---Yes!

Long answer---I really like what someone else outlined briefly - use Query Management queries and forms. They are similar in concept to good old Query/400 queries - those put both the data retrieval (QM query) and presentation (QM form) into one object.

You can even import Query/400 query definitions into QM objects, which are compiled objects.

A QM query (*QMQRY object type) simply holds and SQL statement, SELECT for reports. It can have substitution variables, meaning you can call it from CL with input values.

A QM form (*QMFORM object type) holds the layout and is best created and maintained using STRQM - same for the *QMQRY.

Once you have the query and form worked out, all you need is a command with the parameters you want to use, a command-processing program that takes those parameters, and then that program uses the STRQMQRY command with the form specified and with SETVAR parameter set to the input values. Voila!!

There is a Query Manager - that is STRQM - and that has options for doing both queries and forms. It has an appearance similar to Query/400 if you want at first - then you can get an idea of how the SQL is going to look. And the forms part is very like Query/400 - with some nifty features, like 9-line column heading possible, wrapping text within columns, like that.

For ad hoc or quick reports I know nothing much better - very easy to do.

There is a Query Manager user guide that walks you through it nicely. It is at


And there is a programmer's guide that has helpful stuff - especially about converting from QRYDFN to QMQRY - at



-------------- Original message --------------
From: "Tim Gornall" <tgornall@xxxxxxxxxx>

There appears to be much SQL talent on this list, and I'm thinking I may be
way behind the times. So here's a "how are you guys doing it" question.
A typical example: A request comes in for a new report. It will require
the user to enter some selection data (let's say from and to dates), then
process a bunch of records within RPG. I'm still using open query files,
record select logic in RPG, etc. Are some of you using SQL to do this, is
it a better way, or just different? Would anyone like to share example code
of a clean lean application using SQL?

Thanks, Tim

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

This thread ...

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

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