I want to know one thing regarding file status. Sometimes if you dont define the file status associated with the file, the program runs fine. But I have seen that if you dont mention the file status it abends. After mentioning the file status clause it works fine again. Why this happens? Is it compiler/shop specific?
Joined: 22 Apr 2006 Posts: 6258 Location: Mumbai, India
After mentioning the file status clause it works fine again.
Well, this does not make any sense, can you please show the copile-listings or something which you think can prove this (Some one said that sychic day is Thrusday)
FILE STATUS is an optional clause the FILE-CONTROL paragraph. It monitors the execution of each input-output operation for the file.
When the FILE STATUS clause is specified, the system moves a value into the status key data item after each input-output operation that explicitly or implicitly refers to this file. The value indicates the status of execution of the statement.
Joined: 06 Jun 2008 Posts: 8217 Location: Dubuque, Iowa, USA
But I have seen that if you dont mention the file status it abends. After mentioning the file status clause it works fine again.
If you have the file status code, possible abends can be intercepted and changed into non-zero file status codes. The program isn't working fine, it just is not abending -- there's still something wrong with the code that will eventually bite you because the file isn't being processed correctly, but there's no longer an abend generated.
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
After mentioning the file status clause it works fine again
The absence of an abend does not mean the program ran fine. It still failed and the code should detect the failure and cause a user abend or set some fatal condition code.
If the code is not going to properly detect and respond to invalid file status codes, it would be better to remove them and have the program abend immediately so the problems can be resolved long before the code is run in production.