Microsoft KB Archive/39385

From BetaArchive Wiki

ASSIGN TO PRINTER Will Not Print in COBOL Version 3.0; CALLFH

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

3.00 | 3.00 MS-DOS | OS/2

The information in this article applies to:
- Microsoft COBOL for MS-DOS and OS/2, version 3.0

Summary: When a Microsoft COBOL Version 3.0 program has a SELECT file assigned to PRINTER, output will normally be sent to the printer when the proper record is written. However, when this program has been compiled with the CALLFH compiler directive, the output is never sent to the printer and the program continues as if nothing happened. The CALLFH directive instructs the COBOL system to use an external file handler. Microsoft has confirmed this to be a problem in Version 3.0 of the COBOL Compiler. This problem has been corrected in Microsoft COBOL Version 3.0a. The following code example will not produce any printed output in Version 3.0, but will print in Version 3.0a: The compile line should be: COBOL progname /CALLFH; The LINK line should be: LINK progname; FILE-CONTROL. SELECT PRINT-FILE ASSIGN TO PRINTER. DATA DIVISION. FILE SECTION. FD PRINT-FILE LABEL RECORDS ARE OMITTED. 01 PRINT-REC PIC X(80). WORKING-STORAGE SECTION. 01 TEMP-REC PIC X(80). PROCEDURE DIVISION. OPEN OUTPUT PRINT-FILE. MOVE “This is a simple printer test, eh?” TO TEMP-REC. WRITE PRINT-REC FROM TEMP-REC. CLOSE PRINT-FILE. STOP RUN.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.