LINE-COUNTER is a special register which is automatically defined for each report described in the REPORT SECTION of the Data Division. The internal COBOL notation of this special register is PICTURE S999 USAGE COMPUTATIONAL.
The Report Writer always uses the LINE-COUNTER register to control the vertical spacing of the groups to be printed in a report. For this reason, the LINE-COUNTER register must not be changed by any Procedure Division statement.
As regards the PAGE LIMIT, NEXT GROUP, and LINE clauses, the special register LINE-COUNTER is automatically interrogated and incremented (or set to zero for page advance) by the Report Writer. The INITIATE statement resets the LINE-COUNTER register to zero.
The LINE-COUNTER may be used both in the REPORT SECTION and in the Procedure Division. As far as the REPORT SECTION is concerned, LINE-COUNTER may only be specified in SOURCE clauses as indicated below:
SOURCE IS LINE-COUNTER [OF report-name]
As the Report Writer always sets the LINE-COUNTER register to the current line (print line or NEXT GROUP positioning), the line number will be displayed on which the printable item associated with the above SOURCE clause is to be written. The LINE-COUNTER special register may be interrogated at any time in the Procedure Division; at the time of interrogation, it will contain the value assigned to it by the Report Writer as a result of the NEXT GROUP clause of the last report group generated before the interrogation (last print line of the report group if no NEXT GROUP clause was specified).
If two or more reports are described in the REPORT SECTION, each explicit reference to a LINE-COUNTER must be qualified by the report-name.