sorting a file - sum fields and removing duplicates
Posted: Tue Dec 18, 2012 2:45 am
Hi
I'm very new to this and would love to hear if this is possible to achive and how to solve it.
My file is:
Now, is it possible in my JCL to add a sort that sorts and reduce my file?
The output should be something like this:
The file is sorted by userid, acct and note.
And duplicates (where userid, acct, and notes are same) we remove the the line and sumerize all costs together (see -10 and +10 we get 0).
Is this possible?
How do I solve this? Do you have any good sort manual?
Please advice
Thank you.
I'm very new to this and would love to hear if this is possible to achive and how to solve it.
My file is:
userid acct. note cost-cmp3
333-444 222333 TEXT2 -10
333-444 222222 TEXT1 -20
111-222 111111 TEXT1 -10
111-222 111111 TEXT1 +10
111-222 111111 TEXT2 -20
555-666 111111 TEXT1 -10
333-444 222333 TEXT2 -10
333-444 222222 TEXT1 -20
111-222 111111 TEXT1 -10
111-222 111111 TEXT1 +10
111-222 111111 TEXT2 -20
555-666 111111 TEXT1 -10
Now, is it possible in my JCL to add a sort that sorts and reduce my file?
The output should be something like this:
userid acct. note cost-cmp3
111-222 111111 TEXT1 +00
111-222 111111 TEXT2 -20
333-444 222222 TEXT1 -10
333-444 222333 TEXT2 -20
555-666 111111 TEXT1 -10
111-222 111111 TEXT1 +00
111-222 111111 TEXT2 -20
333-444 222222 TEXT1 -10
333-444 222333 TEXT2 -20
555-666 111111 TEXT1 -10
The file is sorted by userid, acct and note.
And duplicates (where userid, acct, and notes are same) we remove the the line and sumerize all costs together (see -10 and +10 we get 0).
Is this possible?
How do I solve this? Do you have any good sort manual?
Please advice
Thank you.