Variable values for the RUN command

QMF assumes it is at the end of a value for a variable specified on the RUN command when it finds a blank, comma, left or right parenthesis, single quote, double quote, or an equal sign. If the value is enclosed in quotation marks, they are included in the value. If the value is enclosed in parentheses, th e parentheses are not included in the value. To include parentheses in your final value, you must double them.

For example, in processing from the command line, if QMF notices a single or a double quotation mark, it tries to find a match for it. Strings that start with a quotation mark should end with a similar quotation mark. If QMF does not find another quotation mark to pair with the first one, it takes the rest of the command specification and includes it with the beginning quotation mark as part of the value.

To include characters like a blank, comma, right or left parentheses, single quote, double quote, or equal sign in your variable, you can enclose the value specification in parentheses. For example, this RUN command considers the value specification for the variable &X ended at the first command, and does not accept NAME as a RUN keyword:

RUN QUERY (&X=DEPT,NAME,SALARY

The same query can be specified on the command line and is properly processed by adding parentheses:

RUN QUERY (&X=(DEPT,NAME,SALARY)

When the RUN command within a procedure runs a query, the variable parameter can pass a value to a variable within the query. For example, suppose the query uses a variable named &DEPARTMENT. &&DEPARMENT = 66 assigns the value 66 to the variable &DEPARTMENT in the query without making &DEPARTMENT a variable of the procedure. &&DEPARTMENT = &DEPT makes &DEPT a variable of the procedure, and assigns its value to &DEPARTMENT in the query. Values for variables can be set on the SET GLOBAL command before executing the RUN command. However, a value specified on the RUN command overrides the same value set with SET GLOBAL.

If you do not set values for your variables before running your query or procedure, QMF displays a prompt panel so you can fill in the values. Be sure the value assigned to the variable is no longer than 55 single-byte characters (or the equivalent in double-byte characters).

You can specify values for up to 100 variables in a query or procedure. You can specify up to 10 variables on the RUN command; others must be set using SET GLOABAL. QMF first looks on the command for a value, then it looks for a global value. If the limit is exceeded, the command is rejected with an error message. Variable names that do not match parameters in your query are ignored.

If your linear procedure sets a variable using SET GLOBAL, that value is not available to commands in that same procedure. However, it would be available to queries and procedures called by that procedure.

If you omit the &variable parameter, and the object to be run is a query that uses variables, and no global variables are set for those variables, a prompt panel is displayed on which you can fill in variable values. Variables cannot be replaced by other variables on the RUN command.

[ Previous Page | Next Page | Contents | Index ]