Return to the Query Tips
Passing Parms to a Query.
QMQRY (Query Management Query) is the "native" way. 1. Create your query the usual way putting a value in the selection 2. Use rtvqmqry specifying your query name for qmqry parm to get the source of your query 3. Edit the source you just retrieved replacing the literal value you had with a variable (&item) 4. Use crtqmqry cmd to create your *qmqry object 5. In your cl use STRQMQRY QMQRY(xxxxx) SETVAR((ITEM 123)) The source after the retrieve will look like this IF DBITEM IS THE FIELD IN ITEMFILE AND ITEM IS YOUR PARM: SELECT ALL ACMCR, ACMC1, ACMC2, FROM lib/ITEMFILE T01 WHERE DBITEM = &ITEM If you operate with character fields be very careful with the use of quotes .
[report a broken link by clicking here]