Thread: COBOL

What is FILE STATUS and why should I care?

Started by Sam • user3 replies235 viewsLast activity 2 weeks ago
Post #1
0 votes
Sam
Reputation
5
Posts: 28
Joined: Jul 1, 2026, 2:30 PM
Posted: Jul 31, 2026, 11:17 AM

Mentor said never open a file without checking file status. I have seen PIC XX status fields in SELECT.

Is 00 the only good value? What about 97?

Post #2
0 votes
Rick
Reputation
302
Posts: 22
Joined: Jun 14, 2024, 9:41 AM
Posted: Jul 31, 2026, 1:17 PM

FILE STATUS is a two-byte code set after I/O. 00 = OK. 10 = end of file on READ. 23 = key not found. 35 = file not found. 97 sometimes OK on OPEN for VSAM depending on shop.

If you ignore it, the next WRITE/READ can S0C4 and you will not know why.

Post #3
1 votes
Marty
Reputation
412
Posts: 58
Joined: Aug 12, 2024, 9:14 AM
Posted: Aug 1, 2026, 12:17 PM

Put the status check in a copybook paragraph and call it after every I/O. Saves repeating IF logic everywhere.

You must be signed in to reply to this thread