|
I'm not an expert, but my personal opinion is that READC and its associated keywords are somwhere between an abomination and a crime against nature.
That's a little strong :)
In 12 years of RPG I think I've used READC four or five times for very simple data entry, never in "real" apps.
I use it to determine if the user has made any changes to the subfile, but I don't use it for actually reading records for validation or saving to a file.
Since most of my subfile programs involve allowing the user to change a whole list of items, I don't typically want ENTER to advance to the next screen of the program. That would make it impossible to put updated totals on the screen or warning messages, since the program would advance and you wouldn't see them.
Instead, I typically have the user make changes, and then it displays the screen again. Only when the user doesn't make any changes does it advance to the next screen.
And the only way that I know of to determine if any subfile records have changed is by using the READC opcode.
When I validate the records before updating the file or whatever I'm intending to do, I always chain to every record. (If I used SFLNXTCHG it would prevent me from detecting if something has changed, and if I only used READC, I'd only get the records that changed since the LAST time someone hit enter instead of all of the changes since the subfile was loaded... so reading every single record works the best for me.)
However....it's in the language and if you use it correctly, it works. I still think it's a waste of time learning how to do it.
Is there another way to determine if something has changed in a subfile? For some reason (and I can't remember why at this point, I've been doing things this way forever) I don't think the CHANGE keyword works with a subfile.
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.