Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

General description of the Procedure Division

In the Procedure Division, the programmer uses the INITIATE, GENERATE, and TERMINATE statements to instruct the Report Writer to produce the desired report according to its full description in the Data Division.

The INITIATE statement instructs the Report Writer to perform the initialization required for writing the specified report(s). This initialization enables the Report Writer to recognize, for example, whether a given GENERATE statement is the first GENERATE statement to be executed in the sequence of a program.

The GENERATE statement is responsible for creating the major part of the report. It causes a number of automatic functions to be performed in addition to generating a detail report group. For example, the control field test is carried out and a control break takes place, if necessary; that is, control footings and control headings are created. If the associated report group zone of the page does not provide space for a body group (detail report group, control footing, and control heading), then, automatically, the page footing is generated, a page change is implied, and the heading group is created. All of the functions involved in writing the individual report groups, such as incrementing or decrementing counters, supplying value, source, or sum information to the print fields, as well as positioning and writing the line(s) into which the print fields of a report group are structured, are performed automatically.

The TERMINATE statement instructs the Report Writer to complete the creation of the specified report(s). Thus, all control footings that belong to the report and, if present, the report footing as the last report group are written.

Within the range of the DECLARATIVES, the programmer may specify user procedures for report groups following a USE BEFORE REPORTING statement. As such procedures are executed immediately prior to the actual creation (editing, etc.) of the associated report group, this provides the programmer with a means of influencing the representation of the report group at object time.

The following four special registers are known to, and used by, the Report Writer:

LINE-COUNTER, PAGE-COUNTER, PRINT-SWITCH and CBL-CTR.

A report file is a sequentially organized file which is subject to the following restrictions:

Before entering an INITIATE statement, an OPEN OUTPUT or OPEN EXTEND statement must be performed. A TERMINATE statement must be followed by a CLOSE statement (without REEL or UNIT option). No further I-O statement may be issued for this file.