|
Our you looking for something like this? Select repairOrder#, Part, sum(qty) from file Where Group By repairOrder#, Part Sort By repairOrder#, Part Then, you can read through the result set, using control break logic to group the different part numbers on the same subfile record. ---- If you know that there are only 3 part numbers per record, you could join the file to itself. But that would get complicated. Michael Schutte steema@diskhaven. com Sent by: To rpg400-l-bounces@ RPG400-L@xxxxxxxxxxxx midrange.com cc Subject 05/17/2006 11:59 Use SQL instead of RPG? AM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@midrang e.com> HI I have another case here where I think SQL would be put to better use. Instead of building a work file in the RPG program. There are inventory records, specifically Repair records. The system allows for one customer to have up to 5 items in repair. Now they want to see all of the items in repair, by model number, sorted. It is possible to have the same model number per record. call it part1, part2, etc. it's really model number. The layout of the record is: PART #1 CO DIV QTY 1 PART #2 Part#3 etc.. PH15R 1 1 PH5CW PH15R 1 1 PH15R 1 1 PH15R 1 1 PH5CW PH15R 1 1 PH5CW in this case, I want the PH5CW models to follow the PH15R. My thought is to build another work file that would then be sorted. This would be the second work file and RPG. So I was hoping perhaps this could all be done in one SQL? The ultimate purpose is to then show all the model number by total in a subfile. Thanks, Steve -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.