Specifying values on the RUN command prompt panel
When you run a query or procedure with a substitution variable, you can assign a value on the RUN command or through a global variable. However, if the variable in the query or procedure does not have a value, QMF presents a RUN command prompt panel. You can then specify the value for the variable on this panel.
This value for the substitution variable is active only within the procedure that defines it. The value is not active in any procedure or module called from the defining procedure.
Prompting for variables in linear procedures
In a linear procedure, QMF scans the procedure for substitution variables and resolves them before it processes any commands. The user is prompted for all variables before the procedure runs.
Prompting for variables in procedures with logic
In a procedure with logic, the user is not prompted for variables until REXX encounters the statement that contains the variables. To prompt the user one time, you can run a separate procedure that prompts for variables.
For example, you want to be prompted once for the substitution variables LASTNAME and DEPT_NUM. These variables occur on two different lines in your procedure with logic:
/* This procedure runs two queries, displaying the report after each */
/* query has run. */
"RUN QUERY REG_QUERY (&&LASTNAME=&LASTNAME";
"INTERACT"
"RUN QUERY REG2_QUERY (&&DEPT_NUM=&DEPT_NUM";
Add this line to the beginning of your procedure with logic, immediately following the comment lines:
"RUN PROC PROMPT_ME (&LASTNAME, &DEPT_NUM";
In this command, PROMPT_ME is a procedure with logic like the following, which contains a comment line and no instructions:
/* This procedure is a dummy procedure that provides prompting */
The complete procedure includes the RUN PROC command for the PROMPT_ME procedure that prompts for variables:
/* This procedure runs two queries, displaying the report after each */
/* query has run */
"RUN PROC PROMPT_ME (&LASTNAME, &DEPT_NUM";
"RUN QUERY REG_QUERY (&&LASTNAME=&LASTNAME";
"INTERACT"
"RUN QUERY REG2_QUERY (&&DEPT_NUM=&DEPT_NUM";
Alternatively, you can use the SET GLOBAL command to prompt for all the values in your procedure at the same time, as in the following example:
"SET GLOBAL (LASTNAME=&LASTNAME,DEPTNUM=&DEPT_NUM";