You can write a procedure that sets global variable values according to REXX logic. These values are then available to the template query when the procedure issues the QMF RUN QUERY command.
The procedure in Figure 161 sets the query variables as global variables. The results are the same as those explained in Passing variables to the template query.
Figure 161. The procedure sets query variables as global variables.
/* REXX PROC */ IF DATE('W') = 'Friday' THEN DO "SET GLOBAL (SELECT1 = 'NAME, JOB, SALARY, COMM'" "SET GLOBAL (COND1 = '(SALARY > 15000) OR (JOB = 'MGR'')'" END ELSE DO "SET GLOBAL (SELECT1 = '*'" "SET GLOBAL (COND1 = '(DEPT = 51)'" END "RUN QUERY SENIORSTAFF" |