The variable &ALL

&ALL is a special QMF variable that allows you to enter variable values when you enter the synonym, rather than including them in the synonym definition. Use double ampersands in the synonym definition for all variables except the variable &ALL.

&ALL is a special QMF variable that allows you to enter variable values when you enter the synonym, rather than including them in the synonym definition. When you use the variable &ALL in a synonym definition, QMF uses as variable values any information you enter to the right of the synonym. You can use the &ALL variable to show where the variable information is located within the synonym definition.

This synonym definition shows an example of a synonym defined using the &ALL variable.

Figure 1. Using the variable &ALL in a command synonym definition
SYNONYM
VERB        OBJECT     DEFINITION
----------  ---------  ------------------------
SHOW_INFO   -          RUN QUERY STAFFQUERY (&ALL)

The query named STAFFQUERY might look something like the following example:

SELECT * FROM Q.STAFF
WHERE DEPT=&DEPT and JOB=&EMPLOYEE_JOB

After activating the SHOW_INFO synonym defined in Figure 1, you can enter the following statement from the QMF command line to display information about all the managers in Department 10:

SHOW_INFO &DEPT=10 &EMPLOYEE_JOB='MGR'

When you use the variable &ALL in a synonym definition, follow these guidelines:

  • Use &ALL only once in a synonym definition.
  • Always write &ALL in upper case.
  • Never follow &ALL with a number or letter.
  • Any value you substitute for &ALL must be syntactically correct when QMF evaluates the entire command.

If a user does not supply a value following the command synonym, QMF substitutes a null value for &ALL. In the synonym definition shown in Figure 1, QMF prompts the user for values for the &DEPT and &EMPLOYEE_JOB variables if the user enters SHOW_INFO by itself on the command line.