I have the following file.
KEY1 +200.00 KEY2
KEY1 -500.00 KEY2
KEYA +100.00 KEYB
I need to summup the amount fields if all the other fields are same.
the output file shouldbe
KEY1 -300.00 KEY2
KEYA +100.00 KEYB
Please let me know weather it is possible or not in syncsort.
Thanks,
Mehar
summing positive and negative
-
- Posts: 2
- Joined: Sun May 18, 2008 8:10 pm
- Skillset: cobol
jcl - Referer: google
Re: summing positive and negative
meharbabamusa1 wrote:Please let me know weather it is possible or not in syncsort.
I think you will need to convert on INREC with SFF, SUM, and then EDIT on OUTREC.
All is available with Syncsort.
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: summing positive and negative
Hello Mehar and welcome to the forums,
The good news is that you can do what you need with Syncsort as CG said.
In order to do so, you need to provide more info.
Please use the "Code" tag above to show some "real" records (not the way you have, but show the data the exact same as the input records). Show what happens when there multiple values for the "second" key within the "first" key. Will the records actually have an embedded + or - sign or are the numbers implicitly signed? When you post the info, please mention the dsorg and lrecl for the files.
After you type your post, you can use Preview to see your post as it will appear to the forum. When you like the way your post appears, click Submit.
The good news is that you can do what you need with Syncsort as CG said.
In order to do so, you need to provide more info.
Please use the "Code" tag above to show some "real" records (not the way you have, but show the data the exact same as the input records). Show what happens when there multiple values for the "second" key within the "first" key. Will the records actually have an embedded + or - sign or are the numbers implicitly signed? When you post the info, please mention the dsorg and lrecl for the files.
After you type your post, you can use Preview to see your post as it will appear to the forum. When you like the way your post appears, click Submit.
Hope this helps,
d.sch.
d.sch.
-
- Posts: 2
- Joined: Sun May 18, 2008 8:10 pm
- Skillset: cobol
jcl - Referer: google
Re: summing positive and negative
LRECL=40
RECFM=FB
MY INPUT IS
----------------
U,0R,0R,0008,USD,+0000000000134.75,AM002
U,0R,0R,0008,USD,-0000000056679.70,AM002
U,0R,0R,0010,USD,+0000000000100.75,AM002
U,0R,0R,0010,USD,-0000000010000.70,AM002
OUTPUT SHOULD BE
----------------------------------------------
U,0R,0R,0008,USD,-0000000056544.95,AM002
U,0R,0R,0010,USD,-0000000009909.85,AM002
sORRY FOR THE LATE RESPONSE ,I WAS ON VACATION
RECFM=FB
MY INPUT IS
----------------
U,0R,0R,0008,USD,+0000000000134.75,AM002
U,0R,0R,0008,USD,-0000000056679.70,AM002
U,0R,0R,0010,USD,+0000000000100.75,AM002
U,0R,0R,0010,USD,-0000000010000.70,AM002
OUTPUT SHOULD BE
----------------------------------------------
U,0R,0R,0008,USD,-0000000056544.95,AM002
U,0R,0R,0010,USD,-0000000009909.85,AM002
sORRY FOR THE LATE RESPONSE ,I WAS ON VACATION
-
- Similar Topics
- Replies
- Views
- Last post
-
- 2
- 1584
-
by sergeyken
View the latest post
Sun Jan 26, 2025 3:07 am