Reputation: 39
I have a file where the record format Variable Block (VB). The Record length is 225, and the Block size 27998.
How do I declare this in my COBOL program?. I am currently getting file status code 39 which means
The OPEN statement was unsuccessful because a conflict has been detected between the fixed file attributes and the attributes specified for the file in the program. (Attributes that are checked are organization, index keys (primary and alternate), block size and maximum record size)
Here is my current file definition:
SELECT
INPUT-FILE ASSIGN TO INFILE1
ORGANIZATION IS LINE SEQUENTIAL
FILE STATUS IS RETURN-CODE-IN
.
FD INPUT-FILE
RECORDING MODE IS V
RECORD IS VARYING FROM 1 TO 221
BLOCK CONTAINS 0 RECORDS
.
Upvotes: 2
Views: 14458
Reputation: 4407
The RECORD VARYING clause
was introduced in COBOL 85 to define variable length records. The RECORDING MODE clause
was always a non-standard extension for the same use.
Because the RECORD VARYING clause
is sufficient, the RECORDING MODE clause
is redundant, and, therefore, should be removed.
Upvotes: 0
Reputation: 10765
FD INPUT-FILE
Record Varying 1 To 221
Depending INPUT-FILE-REC-LEN
Block 0
Recording V.
01 INPUT-FILE-REC PIC X(221).
[...]
01 WORK-AREAS.
05 INPUT-FILE-REC-LEN PIC 9(004) COMP-5 VALUE 0.
After a successful READ operation INPUT-FILE-REC-LEN will contain the length of the record which has been read.
Upvotes: 4