Microsoft KB Archive/43636

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 19:23, 12 August 2020 by X010 (talk | contribs) (X010 moved page Microsoft KB Archive/Q43636 to Microsoft KB Archive/43636 without leaving a redirect: Text replacement - "Microsoft KB Archive/Q" to "Microsoft KB Archive/")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

ADVANCING Phrase Not OK in Disk File WRITE before COBOL 3.0

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

2.00 2.10 2.20 MS-DOS

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

Summary: COBOL Versions 2.0, 2.1, and 2.2 will not allow carriage-control syntax to be used for disk files. The ADVANCING phrase is not allowed in the the WRITE statement in versions of COBOL earlier than Version 3.0, if the SELECT clause for the output file specifies ASSIGN TO DISK. This combination of language elements will result in the following error messages: Statement deleted due to erroneous syntax Unrecognizable element is ignored. AFTER ADVANCING or BEFORE ADVANCING in the WRITE statement will compile with no errors if the file’s SELECT clause specifies ASSIGN TO PRINTER.

More Information: Programs using COBOL Versions 2.x cannot use the ADVANCING phrase in the WRITE statement to specify line spacing when writing to a disk file, or when the printer name (“LPT1”) is specified in the VALUE OF FILE-ID clause. The code example below demonstrates this limitation, and will give compile-time errors in COBOL Versions 2.0, 2.1, and 2.2. COBOL Versions 3.0 and 3.0a will allow carriage-control syntax for disk files. The program below will compile without error when compiled with COBOL Version 3.0 or 3.0a. The following is a code example: IDENTIFICATION DIVISION. PROGRAM-ID. ADVANCING. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT out ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD out LABEL RECORDS ARE OMITTED VALUE OF FILE-ID IS “file.tst” DATA RECORD IS file-rec. 01 file-rec. 05 file-buffer pic x(80). WORKING-STORAGE SECTION. PROCEDURE DIVISION. MAIN-LINE. OPEN OUTPUT out MOVE “more stuff” TO file-buffer. WRITE file-rec AFTER ADVANCING 3. CLOSE out. STOP RUN.

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