Return to the Query Tips
Passing parameters to query/400
It is possible to pass parameters to a Query/400 query. The basic idea of the solution is in the "Select Records" panel of the Query and in the command used to execute the Query.
1. In the "Select Records" panel: DATE GE :FROMDAT (Note that the colon denotes the Field Name as a parameter) 2. After this is entered in the "Select Records" panel, you will be presented with a " Specify Dependent Value Qualifiers" panel. Key in a "1" and key in the name of the Query. 3. Exit and save the Query as normal. 4. Finally run the Query with the STRQMQRY command and specify the keyword ALWQRYDFN(*YES) and set the variables using the SETVAR keyword. For example: STRQMQRY QMQRY(yourlib/yourqry) ALWQRYDFN(*YES) + QMFORM(*QMQRY) SETVAR((FROMDAT 19991124)) Note that if the parameter to be passed is alpha, you must enclose the value in a set of triple quotes. For example: SETVAR((STATE ''' FL''')
[report a broken link by clicking here]