Microsoft KB Archive/40147

LINAGE Clause in Printer FD Causes Output to Be Off One Line

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

3.00 3.00a 4.00 MS-DOS

Summary: When information is sent to the printer from a Microsoft COBOL version 3.0 or 3.0a program that utilizes the LINAGE clause in the printer file FD, the output may be off by one line throughout the entire printout. The first page will contain one less line than is specified in the LINAGE clause, and the following pages will have the correct number of lines. However, the first line of each subsequent page will actually be the last line of its previous page. Microsoft has confirmed this to be a problem in versions 3.0 and 3.0a and in Microsoft COBOL Professional Development System version 4.0 for MS-DOS and MS OS/2.

More Information: When using the LINAGE clause, COBOL automatically keeps a LINAGE-COUNTER, which maintains the current output line number. When the file is originally opened, the LINAGE-COUNTER should begin with the value one, but is apparently being set to two. The first line of the first page of the printout will be blank, and the actual first line of the file will appear where the second line should be, etc. To work around the problem, you can issue a page eject before your first write to the file, i.e., WRITE AFTER ADVANCING PAGE. From this point on, your output will be correct. Note: This workaround will only work correctly if the END-OF-PAGE clause is NOT used. This program should be compiled accepting the default directives, as follows: input-output section. file-control. select print-file assign to printer. data division. file section. fd print-file label records are omitted record contains 80 characters linage 50 top 8 bottom 8. 01 print-rec. 05 junk-name pic x(77). 05 junk-two pic 9(3). procedure division. open output print-file. move 0 to junk-two. * write print-rec after page. * Un-comment the above line to fix printout perform 132 times add 1 to junk-two write print-rec end-perform. close print-file. stop run.

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