How to Run a Query in QMF Automatically

Before Write a Proc do the below Steps:

  • Create and save the query and form
  • 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 ***

Advertisements

Author: Srini

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