Creating a command synonym table on OS/390

Use the following procedure to create a command synonym table. Then see Entering command synonym definitions into the table for instructions on entering your synonyms and their definitions.

  1. If necessary, acquire or add a table space to hold the command synonym table. On OS/390 the storage container for a table is referred to as a table space. The examples below use the OS/390 default table space name, TBSPACE1. Refer to the appropriate DB2 System Administration manual for how to add a table space. If you do not have an available table space, create one for your table with a query like the following:
    Figure 129. Creating a table space
    CREATE TABLESPACE DSQTSSN1
        IN DSQDBCTL
           USING STOGROUP DSQSGSYN
              PRIQTY 100
              SECQTY  20
              LOCKSIZE PAGE
              BUFFERPOOL BP0
              CLOSE NO

    Running this query creates the table space DSQTSSN1. The storage group and database for this table space are also those for the table space containing Q.COMMAND_SYNONYMS.

    You might be able to use DSQDBCTL.DSQTSSYN as a table space. The Q.COMMAND_SYNONYMS table resides in DSQDBCTL.DSQTSSYN.

  2. From the QMF SQL query panel, run an SQL CREATE TABLE statement similar to the one in Figure 130 to create the table. Substitute your own table name in place of COMMAND_SYNONYMS and your own table space name for TBSPACE1. Type the other portions of the query exactly as shown.
    Figure 130. Creating a command synonym table
    CREATE TABLE COMMAND_SYNONYMS
      ( VERB               CHAR(18)     NOT NULL,
        OBJECT             VARCHAR(31),
        SYNONYM_DEFINITION VARCHAR(254) NOT NULL,
        REMARKS            VARCHAR(254) )
      IN TBSPACE1
    The VERB and OBJECT columns store your synonym. The SYNONYM_DEFINITION column stores the command or procedure that runs when you enter the synonym.

    The columns can be in any order, and you can add a column for comments so users know what function each synonym performs.

  3. Add comments to the DB2 system catalog using the following example for the COMMAND_SYNONYMS table created with the query in Figure 130.
    COMMENT ON TABLE COMMAND_SYNONYMS IS 'SYNONYMS FOR R AND D'
    The phrase SYNONYMS FOR R AND D appears in the REMARKS column of the DB2 system catalog.

    You do not need to add comments about your new table to the DB2 system catalog, but if you do, one comment might be about the table, others might describe the columns. For example, suppose that COMMAND_SYNONYMS has a column named AUTHID that distinguishes private from public synonyms. To add a comment to explain this, run a query:

    COMMENT ON COLUMN COMMAND_SYNONYMS.AUTHID
      IS 'PRIVATE SYNONYM: USE AUTH ID. PUBLIC SYNONYM: USE NULL'

    By running a subsequent COMMENT ON query, you can replace the current one. For more on COMMENT  ON queries, see the DB2 UDB for OS390 Administration Guide.

  4. Create an index to maximize performance at initialization time, when QMF processes the command synonym table. Use a statement similar to the following:
    CREATE UNIQUE INDEX SYNONYMS_INDEX
      ON COMMAND_SYNONYMS (VERB, OBJECT)

    Index both the VERB and OBJECT columns with the UNIQUE keyword to prevent duplicate synonym definitions. If you choose not to use the UNIQUE keyword, QMF allows duplicate synonyms in the table; QMF uses the first synonym it locates in the table and displays a warning message on the QMF Home panel after initialization.

[ Previous Page | Next Page | Contents | Index ]