Writing a procedure that sets global variables for the generic query
You can write a procedure that sets global variable values according to REXX logic. These values are then available to the generic query when the procedure issues the QMF RUN QUERY command.
The following procedure uses the SET GLOBAL command to set values for the variables in the query. The results are the same as those explained in Passing variables to the generic query.
/* 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"