QMF OVERVIEW - IBM Mainframe

For our first look at QMF, we will write a query. Starting at the QMF Home Panel, press PF6 to display a blank SQL Query Panel.

the SQL Query Panel

the SQL Query Panel

The Enter key acts as a toggle between each panel's command line and panel area. Press Enter to get to the panel area and type the following:

the SQL Query Panel

Notice that you can enter comments with dashes as you did in SPUFI. The entry part of the panel can be edited by using the INSERT and DELETE PF keys, which insert or delete lines on the panel. With long queries you may want to use ISPF's editor. It can be invoked by typing EDIT QUERY on the command line and pressing Enter. This transforms the panel area into ISPF EDIT mode and the PF key assignments are now those of your ISPF profile. Now you can use all of the line commands you are used to for deleting, copying, or repeating lines. Another useful aspect of EDIT mode is that you can use PF1 to access the help screen as you would in a TSO session. PF3 will end the ISPF EDIT mode, which you will need to do when you want to tell QMF to run your query. Of course, the same DB2 authorizations will apply here as with SPUFI when you attempt to access data. Using QMF itself also requires DB2 authority, but many installations grant this privilege to PUBLIC, meaning that everyone can use it.

QMF's Default Report for the Query

QMF's Default Report for the Query

Having typed the query, you are now ready to execute it. The QMF command for submitting a query to DB2 is RUN QUERY, which can be typed on the command line or issued through PF2 =RUN. After submitting the query you are presented with the Data Base Status Panel and a cost estimate for your request. This estimate reflects the amount of database work your query will involve. While you cannot take this figure literally, you can get an idea of the amount of overhead that will be involved and decide, if it is excessive to interrupt the query by pressing the Reset key and then PA1. You will then be presented with the choice to continue, cancel, or debug the command. There is a QMF Governor and a DB2 Governor, which can automatically cancel queries, which exceed the installation-set time limit or the installation-set maximum number of rows, retrieved limit.

The results of your query are displayed using QMF's default format, which is quite similar to SPUFI's. The difference between SPUFI and QMF is that with the latter you can modify the format, a topic we will go into in some detail later in this chapter. For now, let us make a simple change. We are on the Report Panel, as noted in the upper left-hand corner of the screen. Notice that PF keys differ from panel to panel. Here, PF9=FORM takes you to the FORMMAIN Panel from which you can modify your report format. We will make a simple change and add a heading to our report:

HEADING===> MY FIRST MYREPORT

If you now press PF12 = REPORT, you will be taken back to the Report Panel where the report will reflect the heading you specified on the Form Panel. If we ended our QMF session now, we would lose our query and our modified report format. Let us assume we will want to run this query again next month. Toggle to the command line by pressing Enter and type:

SAVE QUERY AS MYQUERY

Use whatever name you would like following AS. Assuming that we will also want our modified form, we can type:

SAVE FORM AS MYFORM.

Next month when we want to run this query again we will type: RUN MYQUI-RY (FORM=MYFORM)

Notice, no right parenthesis is required. This overview has now touched on several topics that are worth taking a closer look at. The first is QMF's use of temporary and permanent objects.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

IBM Mainframe Topics