Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/36025

From BetaArchive Wiki

COBOL Version 2.x RUNCOB /P Switch Not Supported in 3.0

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

2.00 2.10 2.20 3.00 | 3.00 MS-DOS | OS/2

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

Summary: In Microsoft COBOL Versions 2.0, 2.1, and 2.2, you can redirect output assigned to PRINTER to a disk file by invoking RUNCOB.EXE, the run-time executor, with the following /P switch: RUNCOB example/P This causes the printer output to be written to PRINT.SPL. The run-time system creates or appends the PRINT.SPL file on the current drive and directory. COBOL Version 3.0 does not support this run-time option. However, COBOL Version 3.0 will allow you to assign a file that uses carriage control syntax (WRITE AFTER 1) to a disk file. Simply replace the word PRINTER in the assign statement with the word DISK, and give the file a name in the FD. Then, after recompiling the program, the output will be directed to a file.

More Information: The following working code example shows the changes that need to be made to a COBOL Version 3.0 program to direct printer output to a disk file: The following is a code example: ENVIRONMENT DIVISION. INPUT-OUTPUT DIVISION. FILE-CONTROL. SELECT OUT-FILE This next line will need to be changed to the following one ASSIGN TO PRINTER ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD OUT-FILE LABEL RECORDS ARE OMITTED *The following line is needed to give it a disk file name VALUE OF FILE-ID IS “PRINT.SPL”. 01 OUTPUT-RECORD PIC X(80). WORKING-STORAGE SECTION. 01 EXAMPLE-LINE PIC X(20) VALUE “This is a simple test”. PROCEDURE DIVISION. OPEN OUTPUT OUT-FILE. WRITE OUTPUT-RECORD FROM EXAMPLE-LINE AFTER 1. WRITE OUTPUT-RECORD FROM EXAMPLE-LINE AFTER 1. CLOSE OUT-FILE. STOP RUN.

Additional reference words: 2.00 2.10 2.20 3.00 Copyright Microsoft Corporation 1993.