VSAM Troubleshooting
File status 97 after OPEN
VSAM file status 97: OPEN failed — the file could not be opened at all.
What it means
- OPEN failed — the file could not be opened at all.
- Check the DD, catalog entry, and dataset state.
Common causes
- Dataset not found or not cataloged.
- OPEN mode conflicts with dataset state.
- Security denial on OPEN.
How to diagnose
- Verify catalog entry and DD.
- Check for security messages.
- Confirm OPEN mode suits the dataset.
How to fix it
- Correct the allocation or the OPEN mode.
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 97 after OPEN 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.
