DECLARE PROCEDURE

You should no longer use this command because it may be discontinued in a future release. To use the newer SQR functionality, use DECLARE-PROCEDURE.

Syntax

Use this syntax:

DECLARE PROCEDURE
[BEFORE-REPORT=procedure_name]
[AFTER-REPORT=procedure_name]
[BEFORE-PAGE=procedure_name]
[AFTER-PAGE=procedure_name]

Description

Defines specific event procedures.

Use the DECLARE PROCEDURE command either in the SETUP section or in the body of the report. You can use the command as often as you like.

If you issue multiple DECLARE PROCEDURE commands, the last one takes precedence. In this way, you can turn procedures on and off while a report is running. The referenced procedures do not take any arguments; however, they may be local. In addition, they can print only into the body of the report; that is, they cannot print into the header and footer areas.

Parameters

Field or Control Description

BEFORE-REPORT

Specifies a procedure to run at the time of the first PRINT command. For example, you use this to create a report heading.

Field or Control Description

AFTER-REPORT

Specifies a procedure to run just before the report file is closed at the end of the report. Use this to print totals or other closing summary information. If no report was generated, the procedure does not run.

BEFORE-PAGE

Specifies a procedure to run at the beginning of every page, just before the first PRINT command for the page. For example, you use this to set up page totals.

Field or Control Description

AFTER-PAGE

Specifies a procedure to run just before each page is written to the file. For example, you use this to display page totals.

Example

For example:

declare procedure
   before-page=page_setup
   after-page=page_totals