View previous topic :: View next topic
|
Author |
Message |
ballaswaroop
New User
Joined: 20 Sep 2005 Posts: 25
|
|
|
|
Hi - I've the following file in the following format, I want to add my amount when ever there is change the number. Number starting from 45 length 18 chars and amount starting from 75 length 8.
Code: |
----+----5----+----6----+----7----+----8----
000000111111111111 PLN 58.01
000000111111111111 PLN 100.02
000000111111111111 PLN 100.41
000000222222222222 PLN 58.01
000000222222222222 PLN 1,2200.02
000000222222222222 PLN 12.00
000000333333333333 PLN 20.00
000000333333333333 PLN 40.00
000000333333333333 PLN 16.00
000000444444444444 PLN 2,3351.29
000000444444444444 PLN 220.04
000000444444444444 PLN 300.05
000000555555555555 PLN 200.03
000000555555555555 PLN 220.04
000000666666666666 PLN 86.93
000000666666666666 PLN 21.79 |
Code'd |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
And what problem are you having? From your sample data, your file is in sequence already, so how are you thinking of using SUM?
You need to temporarily extend your records in INREC to contain a numeric representation of your value, and then use OUTFIL reporting featuers, REMOVECC, NODETAIL, and SECTIONS (for your key) with TRAILER3 using TOT/TOTAL.
You seem to have a regular number of decimal places, so you just need a data-format which will remove the non-numeric characters for you, converting to PD, for instance.
For your output, it looks like you'll need an EDIT, as you'll want the commas and actual decimal-points. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Thse commas in the thousands look a bit funny - shouldn't 1,2200.02 be 12,200.02 etc?
And where do you want these totals - on change of key or at the end or as running totals on each record? |
|
Back to top |
|
|
kranthikumarb
Active User
Joined: 02 Jan 2009 Posts: 115 Location: Hyderabad
|
|
|
|
Ballaswaroop,
Do you want detail records along with individual trailers when key changes or only trailers are needed? Please provide sample output. That would help. |
|
Back to top |
|
|
|