Example of a procedure that requires no user interaction
This example procedure passes a value of a variable to a query, prints a report of the results and saves the data in a table. Finally, the main procedure runs a procedure against the table that was just created.
The following main procedure illustrates how to write a successful procedure that can run in batch mode or through the QMF for TSO stored procedure interface, or start a batch job through the stored procedure interface:
SET PROFILE (CONFIRM=NO
RUN QUERYA (&&LICENSE='007'
PRINT REPORT (PRINTER='
SAVE DATA AS TABLEA
RUN PROCA (&&TABLE=TABLEA
EXIT
- SET PROFILE (CONFIRM=NO
- Eliminates the possible display of confirmation panels.
- RUN QUERYA
- Passes the value 007 to QUERYA for the substitution
variable &LICENSE.
The object names in this command are not qualified with the owner's name. Their owner is, therefore, the current QMF user.
- Prints a report based on the query results; the output goes to the DSQPRINT data set.
- SAVE
- Saves the data in the database.
The SAVE command does not need to contain CONFIRM=NO because of the SET PROFILE command at the start of the procedure. However, if the DATA object is too large for the storage that is reserved for it, the SAVE command might end the procedure because of an incomplete-data condition.
- RUN PROCA
- Runs a procedure that does something with TABLEA (the table that
was just created or replaced by the SAVE command).
The name of this table is passed to the procedure through the &TABLE variable. This command fails if the procedure called contains other substitution variables that have not been set.
- EXIT
- Ends the procedure and exits QMF.
Depending on the commands you use in your procedures, there might be some restrictions or special considerations you need to know about.