USE BEFORE REPORTING

Code statements that execute before HEADING or FOOTING report groups print. You name the report group in the Report Section of the Data Division. You can specify special processing requirements, including calculations in addition to those specified in the SUM clause, and edits to a report line.
Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

See also the DECL and DPAR keywords for creating Declarative Section statements, paragraphs, and sections.

Syntax:

USE BEFORE REPORTING identifier

Parameter:

identifier Designate a HEADING or FOOTING report group. Identifier cannot appear in more than one USE BEFORE REPORTING.

Comments:

  • Remember to name the report group in the Report Section of the Data Division.
  • A USE statement follows a section header in a declaratives section and ends with a period and space. The section can consist of paragraphs that define procedures.
  • A USE BEFORE REPORTING statement cannot alter the value of any control data item.
  • The INITIATE, GENERATE, or TERMINATE clauses cannot appear in a paragraph within a USE BEFORE REPORTING.
  • Report Writer ensures that the designated statements execute just before the specified report group.
  • Declarative statements cannot reference non-declarative statements; conversely, non-declarative statements cannot reference a statement name appearing in the declarative portion. The COBOL PERFORM statement is the only exception of a non-declarative that refers to a declarative statement.

Example:

 NTRY  OPEN INPUT
       OPEN OUTPUT
       PERFORM MAIN-PARA
 DPAR  SUPPRESS-CH-REGION SECTION
       USE BEFORE REPORTING CH-REGION
 DPAR  SUPPRESS-CH-REGION-PARA
          IF FIRST-FLG = TRUE
             SUPPRESS PRINTING