Hi... I know there are many posts similar to this one as I've done all the searches, but I haven't found the exact same problem, and I'm not getting the results I expect, hence this post.
..the first line is OK, but I'm expecting a count of 3 in the second line as there are 3 records that were summed to create the second output record.
Clearly I've not got the syntax correct and I am suspecting it may be something to do with the SECTIONS clause, but I can't find the syntax that gives me the results I need.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
SUM is performed before OUTFIL, so by the time you get to OUTFIL, you only have two records left. Instead of using SUM, you can use SECTIONS by itself. TRAILER3 takes data from the last record of each set of dups. Since you want data from the first record of each set of dups, you have to do a little more work to make that happen.
Here's a DFSORT job that will do what you asked for:
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Ok, if you can't figure it out, let me know and I'll explain it (or just run INREC alone with COPY, and then just INREC with SORT, to see the intermediate output which should help you figure out what's going on).