summing positive and negative

Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL
meharbabamusa1
Posts: 2
Joined: Sun May 18, 2008 8:10 pm
Skillset: cobol
jcl
Referer: google

summing positive and negative

Postby meharbabamusa1 » Sun May 18, 2008 8:25 pm

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

CICS Guy
Posts: 246
Joined: Wed Jun 20, 2007 4:08 am

Re: summing positive and negative

Postby CICS Guy » Sun May 18, 2008 8:45 pm

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.

User avatar
dick scherrer
Global moderator
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am

Re: summing positive and negative

Postby dick scherrer » Sun May 18, 2008 11:45 pm

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.
Hope this helps,
d.sch.

meharbabamusa1
Posts: 2
Joined: Sun May 18, 2008 8:10 pm
Skillset: cobol
jcl
Referer: google

Re: summing positive and negative

Postby meharbabamusa1 » Tue Jun 24, 2008 8:16 pm

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


  • Similar Topics
    Replies
    Views
    Last post