I have one file that I want loop through twice in a CL, but the 2nd time through system finds the file at EOF. How can I accomplish this? (tried to CLOF btw loops but that didn't work)
Announcement
Collapse
No announcement yet.
Need to loop through a file twice in CL (2 RCVF loops) - how?
Collapse
X
-
In the old days, CL would automatically open a file the first time you call RCVF, and automatically close it when you hit EOF (or the program ended). However, people kept asking the same question you've asked "how do I read the file a second time", and there wasn't a great answer. One way is to end/restart the program. Another way is to do a shared open with OPNDBF, code your program so you never hit EOF, and then use POSDBF to move back to the start -- but this was somewhat complex, and people didn't understand the difference between the shared open with OPNDBF/POSDBF/CLOF and the CL program open/closing the file, so they'd hit roadblocks and get frustrated.
Finally, after enough complaining IBM added the CLOSE command ;-)
Comment
Comment