Home > Blogs > Geekish Garrulous Grumblings blogs › Query Management Queries are Queer

Geekish Garrulous Grumblings blogs › Query Management Queries are Queer

November 8th, 2012
nowt as queer as queries

So, I was emailed the following hints and tips document discussing the ubiquitous Query Management Qeuery object type on the IBM Power Server (the artist formerly known as AS400). It's useful to refer to so, here it is:

QMQRY - QUery Management Query


The key to making a query dynamic is converting it into a form that can accept variables. The easiest way to do that is to convert your query to a Query Management Query (QMQRY). A QMQRY is simply an SQL statement stored in a source member. Once the SQL statement has been placed into a source member, you can replace hard-coded values from your original query with variables that can be replaced at execution time. If you've never worked with SQL before, you needn't worry; we will make use of an IBM command that will construct SQL statements for you.

We'll begin by creating the source file used to store your QMQRYs: QQMQRYSRC. To create this source file, use command Create Source Physical File:


Be sure to specify a record length of 91 (source length of 79, sequence number length of 6, date length of 6) instead of the command default of 92, as QMQRY requires a length of no more than 79 bytes for the source statement. If you specify a length of more than 91 on the CRTSRCPF command, you will not be able to run your SQL statements.


Read the original at Geekish Garrulous Grumblings blogs.

Categories: Blogs Tags:
Comments are closed.