An example linear procedure
This example linear procedure selects data, saves the data in a separate table, and prints a report.
Procedure
- Create and save any objects that the procedure must retrieve
from the database.
In this example, REPT4QRY is the name of the saved query, and REPT4FORM is the name of the saved form. Here is the query for this example:
SELECT NAME, ID, COMM FROM Q.STAFF
- On the QMF command
line, enter:
RESET PROC
The PROC panel displays.
- Type the QMF commands
that you want this procedure to run in the order you want them to
run.
If you want to display and interact with panels just as you would if you entered a command on the QMF command line, type
INTERACT
before the command name. - Add, modify, or delete lines in the procedure:
- Type comment lines if you need them. A comment line is a line that begins with two hyphens (--). These lines are ignored when the procedure runs.
- To insert lines in a procedure, move the cursor to the line you want to precede the new line, and press the Insert function key. You can also type INSERT on the QMF command line, move the cursor to the line you want to precede the new line, and press Enter.
- To delete lines from a procedure, move the cursor to the line you want to delete and press the Delete function key. You can also type DELETE on the QMF command line, move the cursor to the line you want to delete, and press Enter.
The following figure shows a procedure that runs the REPT4QRY.
Figure 1. Enter your procedure on the PROC panel. PROC MODIFIED LINE 1 -- MONDAY MORNING REPORT. -- PROCEDURES MAY CONTAIN COMMENT LINES; THEY BEGIN -- WITH TWO HYPHENS. -- A TITLE OR IDENTIFIER AT THE BEGINNING IS USEFUL. RUN QUERY REPT4QRY (FORM=REPT4FORM -- THIS COMMAND RUNS YOUR QUERY AND FORMATS THE REPORT. SAVE DATA AS LASTWEEKDATA (CONFIRM=NO -- THIS COMMAND SAVES YOUR DATA AND OVERRIDES THE VALUE OF -- CONFIRM IN YOUR PROFILE FOR THE DURATION OF THE COMMAND. PRINT REPORT (LENGTH=50 -- THIS COMMAND PRINTS THE REPORT. -- YOU MAY OR MAY NOT WANT TO CHANGE PRINTING -- SPECIFICATIONS BY USING OPTIONS OF THE PRINT COMMAND. MESSAGE (TEXT 'OK, LASTWEEKDATA HAS BEEN SAVED AND PRINTED.' --THE MESSAGE COMMAND CAN BE USED TO DISPLAY A MESSAGE WHEN THE --PROCEDURE HAS FINISHED. *** END *** 1=Help 2=Run 3=End 4=Print 5=Chart 6=Query 7=Backward 8=Forward 9=Form 10=Insert 11=Delete 12=Report OK, cursor positioned. COMMAND ===> SCROLL ===> PAGE
- To save the procedure in the database, enter:
SAVE
QMF prompts you for the name you want to assign to the procedure.
You can also enter: SAVE AS procname. For this example, enter:
SAVE AS MONDAY