If you run a query or procedure that contains a substitution variable, and this variable is not assigned a value by a global variable or on the RUN command, QMF presents a RUN command prompt panel. You can 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.
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.
In a procedure with logic, the user is not prompted for variables until REXX encounters the statement containing the variables. For example, if your procedure with logic contains 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, like 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 3.
/* 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 4.
The completed procedure with logic looks like this:
/* This proc is a dummy proc that provides prompting. */ /* This procedure runs two queries, displaying the report after each */ /* procedure 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 SET GLOBAL to prompt for all the values in your procedure at the same time, as in the following:
"SET GLOBAL (LASTNAME=&LASTNAME,DEPTNUM=&DEPT_NUM";[ Previous Page | Next Page | Contents | Index ]