If your REXX application contains a QMF RUN command with a substitution variable, you must start it using either CMS program_name or TSO program_name.
Whether you are running a procedure with logic or a callable interface program that is invoked by a procedure with logic, commands come into QMF the same way. In this context, the callable interface program becomes a logical extension of the procedure itself.
Consider the command:
RUN QUERY WEEKLY_Q (&DEPT=58
In a procedure with logic, use two ampersands on the substitution variable to pass the variable to the query:
"RUN QUERY WEEKLY_Q (&&DEPT=58"
If a substitution variable has only one ampersand, QMF resolves the variable for the procedure itself, and cannot pass the variable to the query.
If you call a REXX callable interface application from a procedure with logic, and that application contains the command RUN QUERY WEEKLY_Q (&DEPT=58, QMF resolves the variable just as it would for the calling procedure. Because the statement contains only one ampersand, the variable is not passed to the query.
To pass variables to QMF from a REXX callable interface application that is called by a procedure with logic, you have three choices:
When you call the application, QMF does not process any substitution variables it encounters. In the preceding command, &DEPT=58 is passed to the query, where the substitution variable is resolved.
Add an ampersand to every substitution variable so the procedure with logic does not resolve it.
You can define global variables at the start of your application and use them throughout your QMF session.