::cobolfree
REWRITE FILE file-name-1 [RECORD] FROM identifier-1 | literal-1
2002: REWRITE statement 14.8.33.2 / WRITE statement 14.8.47.2 Syntax rules:
10) / 7) If the
FILEphrase is specified [...] literal-1 shall be an alphanumeric, boolean, or national literal and shall not be a figurative constant.
11) / 12) File-name-1 shall not reference a report file or a sort-merge file description entry.
Therefore the following should not compile:
::cobol
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT f ASSIGN TO "asdfs"
SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD f.
01 f-rec PIC 99B99B99.
WORKING-STORAGE SECTION.
01 num PIC 9(6) VALUE 123456.
PROCEDURE DIVISION.
OPEN OUTPUT f
WRITE FILE f FROM zero
WRITE FILE f FROM 0
REWRITE FILE f FROM zero
REWRITE FILE f FROM 0
CLOSE f
.
END PROGRAM prog.
Depending on the amount of changes the fix will either get in 3.0 final or 3.1.
The example demonstrates a different bug:
ASSIGN DISPLAYsomehow suppresses the "OPEN/WRITE/etc. not allowd on SORT files" errors. I will open a separate ticket for this issue.Diff:
Another bug is that replacing
FDbyRDin the modified example causes a segfault. I will fix this now.Last edit: Edward Hart 2018-07-18
Fixed in [r2630].