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
A SOURCE FILE FOR YOUR 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: