VSAM Troubleshooting
File status 23 record not found
VSAM file status 23: Record not found — the READ/START key does not exist in the file.
What it means
- Record not found — the READ/START key does not exist in the file.
- Normal for random reads with bad keys; suspicious for keys that should exist.
Common causes
- Key value wrong (bad input or bad key build).
- Record genuinely deleted.
- START positioned past the desired key.
How to diagnose
- Display the key value used.
- Verify the record exists via a file utility.
- Check key construction logic.
How to fix it
- Fix the key value or handle "not found" as a business case.
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 23 record not found 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.
