In the overview, you entered a query on the Query Panel and then modified and viewed its output on the Report and Form Panels. While still on the Report Panel, you issued the command SAVE QUERY AS MYQUERY, and QMF saved the query you had previously typed on the Query Panel. This is because a query entered on the Query Panel is held in a temporary storage area where it remains until one of three things happens: you type in a different query, you issue the RESET command, or you leave QMF. QUERY is one of QMF's five temporary storage areas. The others are P&TA, FORM, PROC, and PROFILE. So when you typed SAVE QUERY AS MYQUERY, you told QMF to save the, contents of the QUERY temporary storage area in a file named MYQUERY.

Temporary storage areas can be thought of as temporary objects. Each is cleared at the end of a QMF session and only one of each may exist at any given moment during a session. QUERY, FORM, PROC. and PROFILE all have panels of the same name associated with them; DATA does not. DATA is viewed through the Report Panel. The commands SHOW or DISPLAY bring you to the appropriate panel. In our example above, if you issued the command SHOW QUERY, you would be brought to the Query Panel. SHOW FORM would take you to the Form Panel, which holds your most recent modifications. PF keys ca-also be used to navigate to these panels. When you begin a QMF session, the temporary storage areas and. therefore, the panels are empty. When you enter or change the contents of one of those panels, you change the contents of the associated temporary storage area.

As you saw in the overview, temporary objects may be made permanent by issuing the SAVE command. Permanent objects can be recalled into temporary storage through several different commands. The home for permanent objects is the DB2 database.

The QMF objects, QUERY, FORM, PROC, and PROFILE, are stored as rows in the QMF tables, which hold information about QMF objects. DATA is stored as its own DB2 base table. When a permanent object is retrieved, it is copied into the appropriate temporary storage area where you can modify it without affecting the permanent object. If you save the modified version using the same name, you will replace the old version. The command used to clear a temporary storage area is RESET. RESET has no effect on the permanent objects you have created. Now let us take a brief look at each object.


As I have mentioned, QUERY holds a single SQL statement, most commonly a SQL SELECT statement. You may use DISPLAY or SHOW to see the contents of QUERY on the Query Panel and RESET to clear it. RUN QUERY will submit the contents of QUERY for execution. To create a permanent QUERY object, code: SAVE QUERY AS queryname


A QMF query, like any other SQL SELECT statement, returns a subset of data in a result table. In QMF, that subset of data is put into the DATA temporary storage area. Unlike the other temporary objects, DATA is not associated with a panel, so you cannot DISPLAY or SHOW data directly. Instead you would use SHOW REPORT or DISPLAY REPORT. They will bring you to the Report Panel where you can see the contents of DATA formatted by FORM. You can enter a RESET DATA command to clear the temporary storage area and a SAVE DATA AS dataname to save it. SAVE DATA is different from the other QMF SAVE commands. It does not add a row to the QMF object table but, instead, actually creates a new base table in the tablespace specified in your profile. You must have the authority to create a table in this tablespace. The problem with the SAVE DATA command is that the creation of a table causes a lock on its database, and if several QMF users do this at the same time, it could grind the system to a halt. As a result, it is not uncommon to limit the SAVE DATA privilege to a small group of users.


The temporary storage area FORM holds the formatting instructions for DATA. There are actually several panels associated with FORM. Right now we will concentrate on the primary one. You may use SHOW FORM or DISPLAY FORM to go to the first Form Panel, FORM.MAIN. When you execute a query, a FORM, appropriate to that data, is created in the temporary storage area. As with the other panels, you can change the contents of FORM through the Form panels.

For example, in our earlier example we added a heading. If you then issue the RUN QUERY command, the contents of temporary storage area FO*RM are replaced with QMF's default format values again. If you want to run the query and use the current contents of FORM, you must use the following command:


RESET behaves a little differently with FORM. With QUERY, DATA and, as we will see, PROC, RESET clears a temporary storage area. With FORM, it does not empty the temporary storage area; it returns it to QMF's default format values for the current contents of DATA. FORM may be saved in the same way as QUERY.


We turn now to the object PROC. A PROC, or procedure, is an object, which contains QMF commands. SHOW PROC or DISPLAY PROC takes you to the Proc Panel. A procedure may contain one or more QMF commands and can be executed by a single RUN command. We might construct a procedure, which contains the following commands:


Running this procedure changes the contents of the PROC, QUERY, and FORM temporary storage areas. The RESET and SAVE commands are the same for PROC as they are for QUERY and FORM.


Each user has one and only one PROFILE associated with his or her ID. PROFILE holds the characteristics of your QMF session and is the only temporary storage area that is not empty when you begin a QMF session. It is automatically refreshed with the last saved version of your PROFILE. The SAVE command for PROFILE differs from that of other objects in that you cannot SAVE a PROFILE with a particular name. This is because there may be only one PROFILE for any user ID. RESET PROFILE also behaves differently from some of the other QMF objects because rather than clearing the PROFILE temporary storage area, it replaces any modifications you have made with the last saved PROFILE in the database.

There are two ways to modify your PROFILE. You may either use the SET PROFILE command or make the changes on the Profile Panel. To use the panel, type DISPLAY PROFILE or SHOW PROFILE at any QMF command line to go to the Profile Panel Two of the more useful options are CONFIRM and LANGUAGE. CONFIRM determines whether or not you are shown a confirmation panel after submitting a statement to modify a DB2 table. Many QMF commands also allow you to override your PROFILE'S specification by including a CONFIRM clause such as the following:


Your PROFILE will not be changed, but you will be shown a Confirm Panel for the execution of this command. LANGUAGE allows you to choose PROMPTED, SQL, or QBE. You may change from one to another of these options with the SET PROFILE command. If you are on the Query Panel and want to write a query using QBE, just type the following on the command line:


QBE will become the language setting for this QMF session until you exit or issue a RESET PROFILE or RESET QUERY. RESET undoes the modifications made to your temporary PROFILE storage area and resets them to the values of the permanent PROFILE object in the database. If you change a value and issue the SAVE PROFILE command, you will replace the permanent object with this new PROFILE. Notice that no clause is used to name the profile you are saving because there is only one per user.

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

IBM Mainframe Topics