Using QMF


Lesson One: Finding the data you need

In this lesson, you will create a query to show the records for all the clerks in the Q.STAFF table. The Q.STAFF table is one of the sample tables that comes with QMF. You will use the Prompted Query method, because it is the easiest method to learn.

Start by selecting the Q.STAFF table.

To select a table:

  1. On the command line of the QMF Home panel, enter:
    RESET QUERY (LANG=PROMPTED
    

    The Prompted Query panel displays with the Tables panel:

    Figure 6. The Tables panel

    +--------------------------------------------------------------------------------+
    | PROMPTED QUERY                                                 LINE    1       |
    |                                       +-------------------------------------+  |
    |   Tables:                             |               Tables                |  |
    |   > ...                               |                                     |  |
    |                                       | Type one or more table names.       |  |
    |   *** END ***                         |                      1  to 6  of 15 |  |
    |                                       | (                                 ) |  |
    |                                       | (                                 ) |  |
    |                                       | (                                 ) |  |
    |                                       | (                                 ) |  |
    |                                       | (                                 ) |  |
    |                                       | (                                 ) |  |
    |                                       +-------------------------------------+  |
    |                                       | F1=Help  F4=List  F7=Backward       |  |
    |                                       | F8=Forward  F12=Cancel              |  |
    |                                       +-------------------------------------+  |
    +--------------------------------------------------------------------------------+

    Because you know the name of the table you want to use, you can type Q.STAFF on the Tables panel and press Enter. However, for this lesson you will choose the table from a list.

    In addition, you will limit the list to only the tables that belong to user Q and that begin with the letter S. To do that, you use selection criteria. You will learn more about selection criteria in Chapter 3, Displaying a List of Database Objects. In this case, you will use the characters q.s followed by a % sign.

  2. Type q.s% on the first line of the Tables panel.
  3. Press the List function key.

    The Table List panel displays with the names of all the tables that are owned by user Q and begin with S.

  4. Move the cursor to STAFF and type x.

    Figure 7. The Table List panel

    +--------------------------------------------------------------------------------+
    | PROMPTED QUERY                                                 LINE    1       |
    |                                       +-------------------------------------+  |
    |   Tables:                             |               Tables                |  |
    |   > ...                   +-----------------------------------------------+ |  |
    |                           |                  Table List                   | |  |
    |   *** END ***             |                                               | |  |
    |                           |   Name               Owner                    | |  |
    |                           |                                   1 to 5 of 5 | |  |
    |                           |   SALES              Q                        | |  |
    |                           |   SALG               Q                        | |  |
    |                           |   SAMTALE            Q                        | |  |
    |                           | x STAFF              Q                        | |  |
    |                           |   SUPPLIER           Q                        | +  |
    |                           +-----------------------------------------------+ |  |
    |                           | F1=Help  F5=Describe  F7=Backward  F8=Forward | |  |
    |                           | F10=Comments  F11=Sort  F12=Cancel            | +  |
    |                           +-----------------------------------------------+    |
    |                                                                                |
    | OK, LIST command executed successfully.                                        |
    |                                                                                |
    +--------------------------------------------------------------------------------+
  5. Press Enter.

    The Tables panel displays again with Q.STAFF on the first line.

  6. Press Enter to select the Q.STAFF table.

Q.STAFF is displayed under the Tables heading on the left side of the Prompted Query panel. This is called the echo area. The echo area shows you each part of the query as you create it.

The Specify panel is also displayed. Now that you have selected a table, you will use the Specify panel to create the rest of the query.

Figure 8. The Specify panel

+--------------------------------------------------------------------------------+
| PROMPTED QUERY                                       MODIFIED  LINE    1       |
|                                                    +------------------------+  |
|   Tables:                                          |        Specify         |  |
|     Q.STAFF                                        |                        |  |
|                                                    | Select an item.        |  |
|   Columns:                                         |                        |  |
|     ALL                                            | 2 1. Tables...         |  |
|                                                    |   2. Columns...        |  |
|   *** END ***                                      |   3. Row Conditions... |  |
|                                                    |   4. Sort...           |  |
|                                                    |   5. Duplicate Rows... |  |
|                                                    +------------------------+  |
|                                                    | F1=Help  F12=Cancel    |  |
|                                                    +------------------------+  |
|                                                                                |
+--------------------------------------------------------------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]