File status Check while Writing into a Sequential file

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

File status Check while Writing into a Sequential file

Postby Shanthi_Palani » Thu Apr 06, 2017 4:46 pm

Hello Experts,
I have a doubt with the file status checking while writing into a sequential file. Is it not mandatory?
I was with the mindset that all the I/O operation's exceptions are to be handled and the program control has to flow accordingly.
But recently I was analyzing a lot of legacy applications where none of the write verbs' file status were checked. Initially I thought it might have been a miss, but since no where it was handled I think now that, there might be a chance that it was done intentionally.

Kindly will you confirm whether we get any positivity by doing so. I couldn't reach any of the application developers.

I apologize if you find this question as dumb.

Thanks a ton!
Posts: 10
Joined: Mon Oct 10, 2016 3:08 pm
Has thanked: 6 times
Been thanked: 0 time

Re: File status Check while Writing into a Sequential file

Postby Robert Sample » Thu Apr 06, 2017 5:09 pm

Is it not mandatory?
No, checking the file status is ALWAYS optional. COBOL and system z have various ways to indicate a problem with data set access and checking the file status is merely one of those ways. And, depending upon the age of the legacy code, it is entirely possible that they were written before COBOL supported file status codes at all. So the lack of file status code checking could have been deliberate, or it could have been because the mechanism didn't exist when the code was developed.

These users thanked the author Robert Sample for the post:
Shanthi_Palani (Thu Apr 06, 2017 6:14 pm)
Robert Sample
Global moderator
Posts: 3686
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 274 times

Return to IBM Cobol


  • Related topics
    Last post