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]...)]]
Reports that use the 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.
Procedure to execute when the first command execute, which causes output to be generated. For example, you can use the command to create a report heading.
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.
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.
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 pass to the procedure. Arguments can be any variable, column, or literal.
USE-PROCEDURE must be issued in the PROGRAM or PROCEDURE sections of an Production Reporting program. USE-PROCEDURE is a run-time 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 BEFORE-REPORT only before the first output is written to that report, since that causes the BEFORE-REPORT procedure to execute.
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 report. before-page=page_setup after-page=page_total