Calling REXX programs that contain substitution variables
If your REXX application contains a QMF RUN command with a substitution variable, you must invoke it using the TSO program_name command.
Whether you are running a procedure with logic or a callable interface program 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.
For example, consider the following 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 your 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 only
one ampersand is used, the variable is not passed to the query.
To pass variables to QMF from a REXX callable interface application called by a procedure with logic, you have three choices:
- Use the TSO command
to call the application.
When you call the application, QMF does not process any substitution variables it encounters. In the preceding RUN QUERY command,
&DEPT=58
is passed to the query, where the substitution variable is resolved. - Treat all substitution variables in your application as though
you were using them in a procedure with logic.
Add an ampersand to every substitution variable so the procedure with logic does not resolve it.
- Use global variables.
You can define global variables at the start of your application and use them throughout your QMF session. You can also set the DSQEC_USERGLV_SAV global variable to save global variable values from one session to another.