Procedures in QMF for TSO and CICS

Linear procedures and procedures with logic provide two ways to run a series of instructions in QMF for TSO and CICS®. Linear procedures are available in both TSO and CICS environments and contain only QMF commands.

Procedures with logic are available in QMF for TSO and allow you to include REXX logic in addition to QMF commands. The following figure shows an example of a QMF procedure with logic.

Figure 1. An example of a procedure with logic in QMF for TSO
PROC                              MODIFIED    LINE    1

 /* This procedure checks to see what day it is.  If it's
    Monday, it runs a query and prints a report.  If it
    isn't, a message is displayed informing the user.   */
 signal on error
 if date('w') = 'Monday' then
   do
     "RUN QUERY MYQUERY (FORM = MYFORM"
     "PRINT REPORT"
     "MESSAGE (TEXT='OK, MONDAY report has been created and sent to printer.'"
   end
 else
   do
     "MESSAGE (TEXT='Sorry, it is not Monday.  Report cannot be created.'"
   end
 exit 0      /*Exit without errors */
 error:
   "MESSAGE (TEXT = '"dsq_message_text"'"
   exit 8     /*Exit with error condition*/
 *** END ***

Procedures with logic can include any REXX command or function and can also make calls to the operating system or other available environments. In a procedure with logic, you can use conditional formatting, make calculations, or pass commands back to the host environment. You can include both QMF and REXX variables, making the behavior of the procedure data-dependent without rewriting it. You can assign new values to the variables by entering values on the RUN command when the procedure is started or by prompting the user for values using REXX say and pull statements.

QMF provides a special procedure, called a system initialization procedure, that allows you to customize QMF parameters, variables, and session preferences at startup time. You can include any QMF command in the system initialization procedure, allowing you to tailor the QMF session to the operational needs of individual users or groups of users.

In addition to QMF procedures, you can also develop Db2® stored procedures that you can run with a CALL statement on the SQL Query panel in QMF for TSO and CICS. QMF High Performance Option (HPO) also provides a stored procedure environment.