USE-PROCEDURE
Syntax
USE-PROCEDURE [FOR-REPORTS=(report_name1[,report_namei]...)] [BEFORE-REPORT=procedure_name[(arg1[,argi]...)]] [AFTER-REPORT=procedure_name[(arg1[,argi]...)]] [BEFORE-PAGE=procedure_name[(arg1[,argi]...)]] [AFTER-PAGE=procedure_name[(arg1[,argi]...)]]
Description
Changes the procedure usage.
The USE-PROCEDURE command must be issued in the PROGRAM or PROCEDURE sections of an SQR program. USE-PROCEDURE is a runtime command; its compile-time equivalent is DECLARE-PROCEDURE. You can use the command as often as required to change to the necessary procedures required by the reports. If you issue multiple USE-PROCEDURE commands, each remains in effect for that report until altered by another USE-PROCEDURE command for that report. In this way, you can use one to change common procedures for ALL reports and others to change unique procedures for individual reports. The referenced procedures can accept arguments.
If no FOR-REPORTS is specified, ALL is assumed. Initially, the default for each of the four procedure types is NONE. If a procedure is defined in one DECLARE-PROCEDURE for a report, that procedure is used unless NONE is specified.
You can change the BEFORE-REPORT only before the first output is written to that report, because that causes the BEFORE-REPORT procedure to be executed.
Parameters
| Parameter | Description |
|---|---|
|
FOR-REPORTS |
Specifies the reports that are to use these procedures. This argument is required only for a program with multiple reports. If you are writing a program that produces a single report, you can ignore this argument. |
|
BEFORE-REPORT |
Specifies a procedure to execute at the time of execution of the first command, which causes output to be generated. You can use the command, for example, to create a report heading. |
|
AFTER-REPORT |
Specifies a procedure to execute just before the report file is closed at the end of the report. This argument can be used to print totals or other closing summary information. If no report was generated, the procedure does not execute. |
|
BEFORE-PAGE |
Specifies a procedure to execute at the beginning of every page, just before the first output command for the page. It can be used, for example, to set up page totals. |
|
AFTER-PAGE |
Specifies a procedure to execute just before each page is written to the file. This argument can be used, for example, to display page totals. You can also specify arguments to be passed to the procedure. Arguments can be any variable, column, or literal. |
Example
The following example shows the USE-PROCEDURE command:
use-procedure ! These procedures will
for-reports=(all) ! be used by all reports
before-report=report_heading
after-report=report_footing
use-procedure ! These procedures will
for-reports=(customer) ! be used by the customer
before-page=page_setup ! report
after-page=page_totals
use-procedure ! The after-report
for-reports=(summary) ! procedure will be
after-report=none ! disabled for the
! summary report
See DECLARE-PROCEDURE