Using QMF

Specifying values on the RUN command prompt panel

If you run a procedure that contains a substitution variable, and you do not assign a value to the variable using a global variable or on the RUN command, QMF displays a RUN command prompt panel. You can specify the value for the variable on this panel.

Figure 149. Enter a value for a substitution variable.

+--------------------------------------------------------------------------------+
|               RUN Command Prompt -- Values of Variables                        |
|                                                                                |
| Your RUN command runs a query or procedure with variables that need            |
| values.  Fill in a value after the arrow for each variable named below:        |
|                                                                                |
|                                                                 1 to 10 of 10  |
| &DEPARTMENT        38__________________________________________________        |
|                    ____________________________________________________        |
|                    ____________________________________________________        |
|                    ____________________________________________________        |
|                    ____________________________________________________        |
+--------------------------------------------------------------------------------+

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.

In a linear procedure, QMF scans the procedure for substitution variables and resolves them before it processes any commands. It prompts you for all variable values before the procedure runs.

In a procedure with logic, QMF does not prompt you for variable values until REXX encounters the statement that contains the variables. For example, if your procedure with logic includes three statements that contain variables that QMF must prompt you for, QMF prompts you three times--once for each statement.

If you want a procedure with logic to prompt you for all the necessary variable values at one time, as the linear procedure does, use a dummy procedure. Suppose you want to be prompted once for the substitution variables LASTNAME and DEPT_NUM, which occur on two different lines in your procedure with logic as shown in Figure 150.

Figure 150. This procedure requires two substitution variables.


/* This procedure runs two queries, displaying the report after each */
/* procedure has run.                       */
 
"RUN QUERY REG_QUERY (&&LASTNAME=&LASTNAME";
"INTERACT"
"RUN QUERY REG2_QUERY (&&DEPT_NUM=&DEPT_NUM";

Add the following line to the beginning of your procedure with logic, immediately following the comment lines:

"RUN PROC PROMPT_ME (&LASTNAME, &DEPT_NUM";

Where PROMPT_ME is a procedure with logic containing a comment line and no instructions, as shown in Figure 151.

Figure 151. This procedure prompts you to enter the substitution variables.


/* PROMPT_ME is a dummy proc used by other procedures. */
 
"RUN PROC PROMPT_ME (&LASTNAME, &DEPT_NUM";
"RUN QUERY REG_QUERY (&&LASTNAME=&LASTNAME";
"INTERACT"
"RUN QUERY REG2_QUERY (&&DEPT_NUM=&DEPT_NUM";


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]