|
Ron, >>But that isn't the same functionality I was showing. >All that needs to be done for the next break is to remove one of the 'OR' >statements. And yes it does need to be repeated for the number of breaks >you want. "All that needs to be done..." ? Maybe you'd like to repost what you feel is the real equivalent to what my short sample did. For example: What happens when the first record in the file has blanks / zero for some of the break fields? You don't get the initial headings because it does not detect the change. Of course, you can change your code to account for that, but my sample handles it automagically -- regardless of it the first value is nulls or blanks or whatever. And where are your totals printing? If you add output of the totals after detecting the break but prior to printing the headings, then you get extraneous totals on the first record. Of course, we can add code to suppress those too, but again the cycle handles it automagically. And what field names must totals use when they print? By the time you detect the change, the real field names already have the *next* group's values. So you must remember to use the SVxxx names, and make sure you save all the fields you need for printing and calcs or you can print the wrong field value. Very error prone during maintenance if you ask me. Although with RPG IV's ability to prefix externally described DS, it would be easy to have a complete copy of the prior record and you'd just have to remember to use the right field names. Put that all together and compare the length of the code to what I posted. Could I follow the DIY method? Sure, no problem. Can I see at a glance that everything is done correctly and consistently, that first time headings work right, and first time totals don't occur, and that the proper field names are used in all "total" output. No way -- I have to examine the code to make sure the fields are used correctly. It is awful easy to not spot the use (or absence) of the saved version of the field when the names are extremely similar. I think it is more prone to errors while coding, but especially more prone to errors while maintaining the program later. Do you care to post the real equivalent in DIY code, complete with proper first time headings and no first time totals, and with four levels of breaks? It is just a hand-waving exercise to dismiss your previous sample while claiming "all you need to do is...". It does *not* do what my sample program did -- in far less work. My point is I'm trying to get someone to post the *real* code needed to properly account for the same things as my little example. That shouldn't be such a hard request -- if people don't use the cycle they must have some programs laying around which perform the logic in DIY code. I'll give you the credit for at least posting a partial solution. Why has nobody else chimed in with a full solution? Level breaks are not rocket science. Doug
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.