PRINT-SWITCH is a special register that is defined automatically for a program whose Data Division includes the REPORT SECTION. The internal COBOL notation of this register is PICTURE S9 USAGE COMPUTATIONAL-3. Only one such special register is defined for each compilation unit.
The purpose of PRINT-SWITCH is to enable the program to suppress the printing of a report group. This is achieved by including the statement MOVE 1 TO PRINT-SWITCH within a USE BEFORE REPORTING procedure for the appropriate report group. The Report Writer checks the contents of PRINT-SWITCH immediately after each execution of a USE BEFORE REPORTING declarative associated with a report group, and suppresses printing if PRINT-SWITCH contains a 1 . After evaluating PRINT-SWITCH, the Report Writer restores its value to 0, thereby preventing any inadvertent suppression of other report groups.
Report group suppression by the Report Writer has the following effects:
No page spacing as specified by the LINE clauses of the report group.
No editing of print lines.
No page spacing as specified by any NEXT GROUP clause of the report group.
The suppression of a report group owing to the PRINT-SWITCH special register implies, in consequence of the above items a) and c), that the LINE-COUNTER special register is not changed.
PRINT-SWITCH should be set only within USE BEFORE REPORTING declaratives. If it is set anywhere else in the Procedure Division, it is generally impossible to predict which report group might be suppressed.