|
Hi Rob,
It will only work this way if you are doing matching records processing. Otherwise it will work like this
Dow Not %EOF(primary)
Read primary;
// Calc specs
EndDo;
Dow Not %EOF(secondary)
Read secondary;
// Calc specs
EndDo;
Yep, you got it!
And, honestly, I am not sure if it does the calc specs (the first time) before, or after, the read. I remember doing something like putting a record identification indicator and conditioning the calc specs on that indicator. I have an old RPG coding template that might show me this.The calcs are done after the read, but there's a pre-read too! I really wouldn't recommend getting into it for somebody new to the language. When I was teaching RPG/400 when the AS/400 was new, I usually talked about RPG-II a little bit, because most of them would be working with RPG2 programs in converted S36 shops. Not anymore. The cycle was still often used, and OPNQRYF took care of primary file preparation, etc, so I talked about it. If I taught it again, I might very briefly cover that in case they come across one, but not much.
D PreviewRecd E DS extname( FileX ) prefix( in ) D ItemRecd E DS extname( FileX )
And Alan, it's not just COBOL programmers. I sent some code to Jon Paris and it stumped him for quite awhile too, until he realized that it had a primary file. It's just not something that's assumed anymore.
Rob Berendt
That's caught me a couple times recently too.
Alan
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.