Sort Card to Combine records



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Sort Card to Combine records

Postby naveen756 » Sat Jan 02, 2016 7:57 am

Hi,

My project requirement is like the below

1)I/P file: FB and LRECL=9
Contains records like the below

Accnt no Amnt Sign(1Byte)
<1-4> <5-8> <9>
0001 0010 +
0001 0010 -
0001 0010 +
0002 0020 +
0002 0020 +
0003 0030 -
0003 0030 -
0003 0030 -
0004 0040 +
0005 0050 +
0005 0050 +


Input file has duplicate account records and for each account there will be maximum of 3 records.
Output file should have only one record per account and need to sum the amounts in position 5-8 considering the sign in position 9.

2)O/P should be

<1-4> <5-8> <9>
0001 0010 +
0002 0040 +
0003 0090 -
0004 0040 +
0005 0100 +

Thanks a lot
Naveen
naveen756
 
Posts: 2
Joined: Sat Jan 02, 2016 7:36 am
Has thanked: 0 time
Been thanked: 0 time

Re: Sort Card to Combine records

Postby BillyBoyo » Sat Jan 02, 2016 3:13 pm

Have you looked at the OUTFIL reporting features? SECTIONS with TRAILER3 and that with TOT/TOTAL. REMOVECC, NODETAIL. An EDIT mask.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Sort Card to Combine records

Postby naveen756 » Sat Jan 02, 2016 4:59 pm

No, i haven't looked at it.. For unsigned amounts, i can use SUM FIELDS but i don't know how to sum amounts if they are signed.
naveen756
 
Posts: 2
Joined: Sat Jan 02, 2016 7:36 am
Has thanked: 0 time
Been thanked: 0 time

Re: Sort Card to Combine records

Postby BillyBoyo » Sat Jan 02, 2016 6:36 pm

If I had thought SUM FIELDS was a good idea, I'd have suggested it. It would require a SORT of your data, which appears to be in order already in your sample, so SORTing it again would be... far from the best thing to do.

So, look at what I suggested.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post