File Status Code 05

This is not a big deal, but I have an Indexed File that is NOT described as OPTIONAL in the SELECT statement.

When I OPEN the file I-O,  and the file is not there, it creates an empty file (good!  that's what I want!) and returns a status code of 05 (instead of 35).

I would have thought that the status code would have been a 35 in this instance (as it is NOT described as an optional file).

So, my only question is why is it 05 instead of 35 in this case?

Thanks.

Parents
  • Verified Answer

    Hi Austin1, this behavior depends on the setting of the OPTIONAL-FILE directive.  By default this directive is set on, giving the behavior you've observed, i.e. an OPEN I-O or OPEN EXTEND on a file that does not exist will create the file, returning a status of 05.

    If you compile the program with the directive NOOPTIONAL-FILE, the OPEN I-O on a non-existent file will NOT create the file and will return a status of 35.

Reply
  • Verified Answer

    Hi Austin1, this behavior depends on the setting of the OPTIONAL-FILE directive.  By default this directive is set on, giving the behavior you've observed, i.e. an OPEN I-O or OPEN EXTEND on a file that does not exist will create the file, returning a status of 05.

    If you compile the program with the directive NOOPTIONAL-FILE, the OPEN I-O on a non-existent file will NOT create the file and will return a status of 35.

Children
No Data