Skip to content

Initiate Statement

The INITIATE statement must be the first report writer statement to be executed for a report.

initiate statement

Initiate Statement: Coding Rules

  • Each report-name must be the name of a report in the current program, or that of a GLOBAL report defined in a containing program. (The report-name appears immediately after the RD level-indicator and also in the REPORT clause in the FD.)

  • If the UPON phrase is present, each report-name must be defined in a REPORT(S) clause in the FD of the specified file-name. The UPON phrase must be used if any of the report-names is defined in more than one FD entry.

  • INITIATE must not appear in a USE BEFORE REPORTING directive Declarative.

Initiate Statement: Operation

  • An INITIATE must be executed for a report before any GENERATE, INITIATE, or Page Buffer SET verb referring to the same report (or a DETAIL in the report) is executed.

  • An OPEN for the corresponding report file must have been executed before the INITIATE is executed. The INITIATE does not OPEN the file. You may however execute an INITIATE once again for a report that was TERMINATEd without closing and re-opening the file. This fact may be used repeatedly to obtain REPORT FOOTING and REPORT HEADING groups in the interior of the report, or to obtain a fresh page with PAGE-COUNTER reset to 1.

  • A CLOSE must not be issued for the file to which a report is directed once the report has been INITIATEd, unless a TERMINATE is first done.

  • If an UPON phrase is present, the report will be written only to the file specified.

Initiate Processing Cycle

The following is a more thorough description of each stage in the execution of an INITIATE statement:

  • The error flag is cleared.

  • If your report is associated with a DUPLICATED file and REPORT-NUMBER is zero, the remaining actions are performed for every duplicate report.

  • If your report is associated with an Independent Report File Handler, the file handler is invoked with an action code of 6.

  • If the identifier form of a LINE LIMIT clause was coded, the identifier is checked and, if valid, stored in the Report Control Area.

  • Other internal locations and special registers, such as the current position, "body group has appeared on page" indicator, REPEATED-COUNTER, and PAGE-COUNTER are cleared.

  • LINE-COUNTER is reset to zero.

  • PAGE-COUNTER is set to 1.

  • All total fields, sum overflow indicators, size error indicator and Saved Next Group integer, and PRESENT AFTER indicators, wherever appropriate, are cleared to zero.

  • The control break indicator is set to -1 to indicate "initial control break on INITIATE".

  • If a run time subroutine is used for control-break detection, the lengths of each control identifier (other than REPORT/FINAL) are determined and stored in a control area.

Compatibility

The coding rules for the INITIATE are identical for OS/VS COBOL and DOS/VS COBOL Report Writer, and new Report Writer. The INITIATE statement may perform additional actions if new Report Writer functions have been used in the Report Group Descriptions.

Access to a GLOBAL report is not available with OS/VS or DOS/VS COBOL.

The UPON phrase is not supported by OS/VS or DOS/VS COBOL.

Back to top