Page 1 of 1
Follow up on COBOL Tip 11.
Posted: Tue Jan 21, 2014 5:59 pm
by Mahesh Ayyar
Pandora-Box wrote:11.When ever we do processing reading a file better to have an approach like this
Templace
Code: Select all
Open file
Read file
process until EOF
"MAIN PROCESSING"
Read file
Close file
Hi,
May be I did not get it but - why do you say so Pandora?
Re: COBOL Tips doubt
Posted: Tue Jan 21, 2014 6:07 pm
by zprogrammer
Hi,
Mahesh I believe it more structured way of programming
Re: Follow up on COBOL Tip 11.
Posted: Wed Aug 20, 2014 2:14 pm
by Mahesh Ayyar
This been a while but trying to understand it, you mean to use proper indentation?
Re: Follow up on COBOL Tip 11.
Posted: Wed Aug 20, 2014 3:53 pm
by William Collins
No, it is the use of what is sometimes called a "Priming Read". If you notice, there are two Reads in the example. One immediately before the loop, and one the last thing in the loop. The code within the loop will only be processed when a record is present. With a Read at the top of the loop, you end up with squirming about to avoid processing a record when you have reached end-of-file.