Jack Straw
2003-07-11 00:39:01 UTC
I'm an experienced programmer, trying to get up to speed on Cobol.
I've read the source to a few programs from various places, and I have
a methodology question.
When reading a file to it's end, most of the code i'm reading is along
these lines:
1000-read file.
read filename into varname
at end move 'y' into ws-eof-switch
end-read
Then, later on, the programmer is looking at ws-eof-switch.
Why would one do that instead of (what makes more sense to me)
declaring "file status is ws-file-status" in file control, and then
looking at the file status after the read. That will give a return
code telling exactly what happened during the I/O and not a simple
boolean.
Am I missing something, or is it just dumb luck that I have weird code
examples?
The first technique seems very common.
I've read the source to a few programs from various places, and I have
a methodology question.
When reading a file to it's end, most of the code i'm reading is along
these lines:
1000-read file.
read filename into varname
at end move 'y' into ws-eof-switch
end-read
Then, later on, the programmer is looking at ws-eof-switch.
Why would one do that instead of (what makes more sense to me)
declaring "file status is ws-file-status" in file control, and then
looking at the file status after the read. That will give a return
code telling exactly what happened during the I/O and not a simple
boolean.
Am I missing something, or is it just dumb luck that I have weird code
examples?
The first technique seems very common.
--
JackStraw
0x3D561045
JackStraw
0x3D561045