DB2 graphic  QMF Version 8

Choosing the synonym definition

The synonym definition is the QMF command or procedure that runs when the user enters the command synonym.

Choosing the synonym on z/OS

An entry in the SYNONYM_DEFINITION column can include:

Your synonym definition can even include both types of commands if the definition runs a QMF linear procedure.

For information about developing complex applications to run in a command synonym, see Developing DB2 QMF Applications.

Using a linear procedure in the synonym definition

A linear procedure is a QMF procedure that executes QMF commands sequentially. Your synonym definition can include a linear procedure that does the work of several QMF commands. For example, the procedure in Figure 55 performs the following tasks:

  1. Runs the following query, called SALES_DATA, which creates a report that shows all the customers handled by sales representative number 20:
    SELECT QUANTITY, CUSTNO
    FROM Q.SALES
    WHERE SALESREPNO = 20
  2. Routes the report from QMF to TSO virtual storage or a CICS temporary queue. In Figure 55, XYZ is the name of the temporary storage queue.
  3. Runs a CICS or TSO procedure to route the report from virtual storage to a predefined print destination. In Figure 55, RPTX is the transaction name. It runs asynchronously with QMF to route output to a destination named REPORTX.
Figure 55. Sample procedure to run using a command synonym
-- Procedure name: SALES_PROC
 RUN QUERY SALES_DATA
 PRINT REPORT (QUEUENAME=XYZ,QUEUETYPE=TS)
 TSO RPTX (FROM=('REPORTX, XYZ'))
 

Your definition for a synonym that runs this procedure might look similar to the one in Figure 56:

Figure 56. Using a command synonym to run a linear procedure
SYNONYM
VERB           OBJECT           DEFINITION
-----------    ---------------  -------------------
SHOW           SALES            RUN PROC SALES_PROC

If you are using an NLF: Make sure that the QMF commands in the queries, forms, and other objects included in the procedure are translated before you use the command synonym that calls the procedure. Also ensure these components are suitable for the NLF you are using. Unless your procedure sets the DSQEC_NLFCMD_LANG variable to 1, ensure the commands are translated before you use the command synonym.

Using variables in the synonym definition

You can use variables in the synonym definition to pass values for like-named variables present in objects (such as queries) named in the definition. For example, Figure 57 shows a definition that passes the value Q.STAFF for the table name, which is evaluated when MYQUERY runs.

Figure 57. Using variables in command synonym definitions
SYNONYM
VERB        OBJECT     DEFINITION
----------  ---------  --------------------------------------
EXECUTE     -          RUN QUERY MYQUERY (&&TABLENAME=Q.STAFF

MYQUERY might look something like:

SELECT * FROM &TABLENAME

Ampersands are doubled in a variable name in the synonym definition because they become single ampersands when QMF executes the RUN command.

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 information is located within the synonym definition.

The synonym definition in Figure 58 shows an example of a synonym defined using &ALL.

Figure 58. 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:

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

After activating the SHOW_INFO synonym defined in the preceding example, 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'
Rules for &ALL

When you use the variable &ALL in a synonym definition:

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 58, 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.

Keying information into the SYNONYM_DEFINITION column

Follow these rules when keying your synonym definitions into the synonym table:


Go to the previous page Go to the next page

Downloads | Library | Support | Support Policy | Terms of use | Feedback
Copyright IBM Corporation 1982,2004 Copyright IBM Corporation 1982, 2004
timestamp Last updated: March, 2004