"Philosphical" question on "succesful" file status testing
- From: "William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx>
- Date: Sat, 29 Apr 2006 17:02:36 GMT
As a follow-up to another thread and NOT expecting consensus of opinion, I
thought I would ask this question:
When is it a "good" thing to test only the first character for "0" versus
testing for specific file status codes?
(This IGNORES the entire question of any "9x" "successful" status codes like
IBM's "97")
****
The question that I would ask is when writing a program isn't it
"program-specific" whether you would want to handle NEW successful status codes
the same as old ones?
In other words, suppose you have two approaches for "successful" status code
checking today.
Approach 1:
If FS-1 = "0" *> checks first byte (character) for "0"
versus
Approach 2:
If FS-both = "00" or
FS-both = "02" or
FS-both = "04" or
FS-both = "05" or
FS-both = "07"
Now either of these could be replaced by 88-level tests (and I am not asking
about that)
The question is (then) what happens if the implementation (as an extension, new
implementor defined "0x" or the Standard) introduces a new "0?" successful
status code.
For example, (and this is QUITE contrived and I don't think it will/would ever
happen),
If the Standard introduced a "09" status code to indicate that an OPEN was
successful but the file was on a non-mass storage device. (This might be
useful information for some applications).
If seems to me that an application programmer more often than not (but NOT
universally) should check for the specific status codes that are "known" at the
time the application is created. In that way, any NEW "successful" status code
will "fall thru" (probably to error handling). It may be that the application
will NOT need changing to handle the newly available information, but it is ALSO
possible that the newly detected situation would require "new program logic".
Therefore, if I were to make a suggestion for new program development, I would
probably suggest checking BOTH bytes (but NOT just for "00") for successful I/O
status - and to make certain that "currently unknown values returned" cause
error process to be activated. This certainly would not be necessary for all
applications but MIGHT be useful for some/many.
--
Bill Klein
wmklein <at> ix.netcom.com
.
- Follow-Ups:
- Prev by Date: Re: jcl sort question
- Next by Date: Re: IBM file status 97 (was: Prodcuing an output file onlyonFriday?
- Previous by thread: Problem using java with cobol
- Next by thread: Re: "Philosphical" question on "succesful" file status testing
- Index(es):
Relevant Pages
|