How to Run a Query in QMF Automatically

Before you write a Procedure, here are the steps mandatorily to complet.

  1. Create and save the query and form
  2. Enter: RESET PROC

The PROC panel displays.

Example Proc:
/* 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 ***

Related posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.