# File status 39: File attributes conflict with the program

Source: https://wndsoftware.com/mainframe-errors/file-status-39

### File status 39: File attributes conflict with the program

File status 39 means OPEN found a conflict between the file's real attributes and what the program declares, such as record length, record format, key position or file organization. The OPEN fails.


#### Other names for this code

Also written as `FS 39`, `file status code 39`, `COBOL status 39`, `VSAM status 39`, `file attribute mismatch COBOL`, `status key 39`, `SK39`.


### What it means

Status 39 is a permanent error from OPEN. The file exists and the mode is fine, but its fixed attributes don't agree with the program's SELECT and FD. IBM's list of attributes covers the organization, the prime and alternate keys, the code set, the maximum record size, the record type and the blocking factor.

For QSAM the usual problems are record length and format. With fixed-length (F or FB) records, the FD record length must equal the data set's LRECL. With variable-length (V or VB) records, the largest FD record must be 4 bytes less than LRECL, because LRECL includes the 4-byte record descriptor word. A RECORDING MODE of F against a V data set, or the reverse, also gives 39. Printer files may need one extra byte in LRECL for the carriage control character, depending on the ADV compiler option.

For VSAM, COBOL compares the RECORD KEY and ALTERNATE RECORD KEY clauses with the key lengths and positions in the catalog, and the FD's record size with the cluster's. A file described as QSAM whose DD points at a VSAM cluster also fails with 39. These checks are made by COBOL after the access method has opened the file, so data-name-8 usually holds no VSAM error code.


### Common causes

- The copybook changed length and the program was recompiled, but the data set wasn't rebuilt, or the other way round.
- A variable-length FD whose largest record equals LRECL, forgetting the 4-byte RDW.
- RECORDING MODE F in the program for a RECFM=VB data set, or the reverse.
- The cluster's KEYS(length offset) doesn't match the length and position of the RECORD KEY field in the record.
- The ALTERNATE RECORD KEY clauses don't match the alternate indexes defined over the cluster.
- The DD points at a VSAM cluster for a file the program describes as sequential.


### How to find the problem

- Look in the job log for the IGZ warning issued with the 39. IGZ0201W gives both record lengths. IGZ0200W covers a QSAM file pointed at a VSAM data set, IGZ0202W and IGZ0203W cover ASCII mismatches, and IGZ0204W covers RECORDING MODE.
- For QSAM, check RECFM, LRECL and BLKSIZE in ISPF option 3.4 and compare them with the FD record length in the compiler listing.
- For VSAM, run IDCAMS LISTCAT ALL and compare KEYLEN, RKP and MAXLRECL with the program's key and record definitions. Check each alternate index too.
- If there's no FILE STATUS clause, IGZ0035S follows the warning and the program ends with U4038.


### How to fix it

- Make the FD and the data set agree. For a QSAM FB file, the FD record length equals LRECL. For VB, the largest record is LRECL minus 4.
- Code BLOCK CONTAINS 0 RECORDS in the FD so the block size comes from the data set or the system, not from the program.
- For VSAM, redefine the cluster with the right KEYS and RECORDSIZE, or correct the key clauses, then recompile every program that uses the file.
- Point the DD at the right data set if a VSAM cluster and a sequential file have similar names.


### IBM documentation

[IBM Enterprise COBOL documentation](https://www.ibm.com/docs/en/cobol-zos/6.4.0). Use the documentation for your installed release.

This link opens the relevant IBM reference library or lookup instructions. Match the complete code and your installed product release; it is not a code-specific review.

[Report a correction to WND Software](https://wndsoftware.com/contact#message).

Last reviewed 2026-10-18 by the WND Software team. Written in our own words. For the full reference, check IBM’s Enterprise COBOL documentation for your release.


### Related codes

[IGZ0201W File attribute mismatch Read →](https://wndsoftware.com/mainframe-errors/igz0201w)
[File status 04 Record length doesn't match the FD Read →](https://wndsoftware.com/mainframe-errors/file-status-04)
[File status 35 Required file not available at OPEN Read →](https://wndsoftware.com/mainframe-errors/file-status-35)
[File status 37 OPEN mode not supported by the file Read →](https://wndsoftware.com/mainframe-errors/file-status-37)
[S013 Data set could not be opened Read →](https://wndsoftware.com/mainframe-errors/s013)
[IEC141I Data set open failed (abend 013) Read →](https://wndsoftware.com/mainframe-errors/iec141i)

### Questions


#### Why does my VB file give 39 when the lengths look right?

LRECL for a variable-length file includes the 4-byte record descriptor word. The largest record in the FD must be LRECL minus 4.


#### Does a 39 come with a VSAM return code?

Usually not. VSAM opened the file without complaint, and COBOL found the conflict afterwards by comparing attributes, so look at the IGZ message and LISTCAT instead.


#### What is the difference between 39 and 04?

39 stops the OPEN because a fixed attribute conflicts. 04 is a warning on one READ whose record length is outside the FD's range.

[COBOL file status codes](https://wndsoftware.com/mainframe-errors/cobol-file-status) · [File status 38](https://wndsoftware.com/mainframe-errors/file-status-38) · [File status 41](https://wndsoftware.com/mainframe-errors/file-status-41)

[← All error codes](https://wndsoftware.com/mainframe-errors/)
