VSAM Troubleshooting
File status 39 file attribute mismatch
VSAM file status 39: Attribute conflict — the FD definition in the program disagrees with the actual cluster attributes.
What it means
- Attribute conflict — the FD definition in the program disagrees with the actual cluster attributes.
- Classic: program says SEQUENTIAL but cluster is a KSDS, or record lengths differ.
Common causes
- FD organization does not match cluster type.
- Record length in FD differs from defined MAXLRECL.
- KEY length/position mismatch for KSDS.
How to diagnose
- Compare FD SELECT/ORGANIZATION with LISTCAT output.
- Check record and key lengths on both sides.
How to fix it
- Align the FD with the cluster, or redefine the cluster to match the program.
Example: Always check FILE STATUS after I/O
READ CUSTFILE NEXT RECORD
AT END MOVE 'Y' TO WS-EOF
NOT INVALID KEY CONTINUE
END-READ.
IF WS-FS NOT = '00'
DISPLAY 'File status: ' WS-FS
END-IF.
FILE STATUS after every I/O turns mystery failures into clear codes.
Interview tip
- Q: How would you troubleshoot a File status 39 file attribute mismatch in production?
- A: I would confirm the exact file status code, check the JCL DD and catalog, then apply the specific fix.
Prevention checklist
- Check FILE STATUS after every OPEN/READ/WRITE.
- Keep FD layouts in sync with cluster definitions.
