Microsoft KB Archive/43257

From BetaArchive Wiki

How to Use the NEXT PAGE Clause in the COBOL Report Section

PSS ID Number: Q43257 Article last modified on 04-20-1993

3.00 3.00a MS-DOS

The information in this article applies to:
- Microsoft COBOL for MS-DOS, versions 3.0 and 3.0a

Summary: The NEXT PAGE clause in the COBOL Version 3.0 report writer causes the line being generated to be displayed on the NEXT PAGE. NEXT PAGE does not cause the report writer to generate a form feed to the printer. Instead, the report writer counts how many lines have been printed on the current page and prints the necessary number of blank lines to move to the next page. The number of lines per page is set with the PAGE LIMIT clause. Therefore, if the PAGE LIMIT clause is set to fewer or greater than the number of actual lines on the printout page, the NEXT PAGE clause will not function correctly.

More Information: The NEXT PAGE clause is only allowed in the CONTROL HEADING (CH), CONTROL FOOTING (CF), or DETAIL (DE) TYPE report group. If used in one of the other TYPEs, it will generate a compile time error 277. Also, in order to generate a blank page in a report, you must GENERATE twice in a row a blank detail line that contains a NEXT PAGE clause. A PAGE HEADING or PAGE FOOTING will always be printed on a page so that a completely blank page cannot be generated when using these TYPEs. Code Example The following is only a partial COBOL program that demonstrates how to generate a blank page with the NEXT PAGE clause of a report section: DATA DIVISION. REPORT SECTION. RD GENERAL-REPORT PAGE LIMIT IS 66 LINES FIRST DETAIL 1. 01 NEXT-PAGE TYPE IS DETAIL. 05 LINE NUMBER IS 1 ON NEXT PAGE. 10 COLUMN NUMBER 1 PIC X VALUE SPACE. * The rest of the report groups go here. PROCEDURE DIVISION. INITIATE GENERAL-REPORT. GENERATE NEXT-PAGE. GENERATE NEXT-PAGE. STOP RUN.

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.