Page 1 of 1

Sort Card to Combine records

PostPosted: Sat Jan 02, 2016 7:57 am
by naveen756
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

Re: Sort Card to Combine records

PostPosted: Sat Jan 02, 2016 3:13 pm
by BillyBoyo
Have you looked at the OUTFIL reporting features? SECTIONS with TRAILER3 and that with TOT/TOTAL. REMOVECC, NODETAIL. An EDIT mask.

Re: Sort Card to Combine records

PostPosted: Sat Jan 02, 2016 4:59 pm
by naveen756
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.

Re: Sort Card to Combine records

PostPosted: Sat Jan 02, 2016 6:36 pm
by BillyBoyo
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.