TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

DB2 - Query Management Facility(QMF)


QMF (Query Management Facility) is an interactive query tool used to produce formatted query output. It is similar to SPUFI but has much more advanced features to produce formatted output.

Use “TSO QMF” command in the ISPF main menu; you will get the QMF Home Panel as follows:

This command is varying depends on installation.

image missing

Notice the numbered options in the bottom portion of the screen. These numbers correspond to QMF functions.

There are three basic QMF objects to produce formatted reports of DB2 data:

  1. Queries
  2. Forms
  3. Procs

Queries:

You will see how to produce a simple report:

  • Press F6 to navigate to the QMF Query panel, which is initially blank.
  • Type the following statement at the COMMAND prompt and press Enter DRAW table_name
  • Following panel will appear:
image missing

To run this query, press F2 which will produce this report.

image missing

You can save a query by typing the following in the Command prompt- SAVE AS query_name

Press F4 to print the report.

You can format this report using Forms by pressing F9.


Forms:

Forms are used to format the report of the query output. Press F9 to go to a Form.

A default form is generated for each query when it is run.

QMF Forms enable us to perform the following:

  • Code a different column heading.

  • Specify control breaks.

  • Code control-break heading and footing text.

  • Specify edit codes to transform column data (for example, suppress leading zeroes or display a currency symbol).

  • Compute averages, percentages, standard deviations, and totals for specific columns.

  • Display summary results across a row, suppressing the supporting detail rows.

  • Omit columns in the query from the report.

QMF Form Panel is as follows:

image missing
Procs:

A QMF query can contain only one SQL statement in contrast with SPUFI, which can contain multiple SQL statements as long as they are separated by a semicolon.

QMF Proc is used to execute multiple SQL statements at one time.

QMF Procs contain QMF commands that are tied together and executed serially.

By pressing F10, you can enter into PROC and can execute the queries as follows:

image missing

Following is a typical QMF user's session. If you type a single SQL statement and press a few function keys, then an end-user report is generated.

image missing


If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal