I spent several hours agonizing about how to respond to the last post in this thread. At the risk of starting a controversy, I decided to respond as follows.
First, I am a Natural teacher, have been ever since Natural was developed. If I had a student come to me after a one week introductory class and admit they could not write the code for the report above, I would wonder if I had done a poor job teaching or if the student was awake. I have workshops in my introductory class that are just like the report above, some are even harder.
Ramesh, if I, or someone else, were to simply write the code for you, it would not, as in your quote, be a “great help” to you. You would learn nothing about Natural. Worse, your manager/supervisor would assume you know far more Natural than you do, and your next assignment would be a lot tougher.
If this were a class workshop, I would suggest that you write a HISTOGRAM loop (assuming we have the entire report description in your last post, which indicates that the only required fields are in the superdescriptor) and write out the values of the super.
Then, REDEFINE the super to access the individual component parts, and write some code (try AT BREAK) to isolate the appropriate records (transaction/option pair). As evident by your posting, which just came in while I am writing this, that is similar to what you were doing. However, my suggestion was based on your very meager original description of the problem. I suggested using READ and SORT, which it would appear is not necessary at all.
Play with the HISTOGRAM loop. You should be able to figure out (especially since you are familiar with AT BREAK) how to write the report.