IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to SUM the values using syncsort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
elijarajesh.mf
Warnings : 1

New User


Joined: 02 Feb 2010
Posts: 14
Location: hyderabad

PostPosted: Thu Jul 07, 2011 11:44 am
Reply with quote

I would like to add a field based on two fileds in syncsort. Please find the below example:
A B C D
------- --- ----------------- ------
M0001 1 SWITCHING CA 19999
M0001 1 SWITCHING CA 19999

In this example I want to sum the coluomn B based on Column A & Coloumn D. If A & D matches then ADD B. Please suggest how to write this using syncsort.

Thanks,
Rajesh.
Back to top
View user's profile Send private message
prasanth_thavva

New User


Joined: 28 Jul 2005
Posts: 86
Location: Chennai

PostPosted: Thu Jul 07, 2011 11:50 am
Reply with quote

Can you post the field length and also post your control which you are trying to acheive the result.

On response to this, pls post and input and out put expected results.
that will help us to fine tune ur control card.
Back to top
View user's profile Send private message
elijarajesh.mf
Warnings : 1

New User


Joined: 02 Feb 2010
Posts: 14
Location: hyderabad

PostPosted: Thu Jul 07, 2011 11:59 am
Reply with quote

After sorting I want to get the record like this:


Input:

A B C D
------- --- ----------------- ------
M0001 1 SWITCHING CA 19999
M0001 1 SWITCHING CA 19999


Expected output:

A B C D
------- --- ----------------- ------
M0001 2 SWITCHING CA 19999 --------> In Column B values is 2 now with single record.

Lengths:
Coloumn A -----> 5 BYTES
Coloumn B -----> 3 BYTES
Coloumn C -----> 13 BYTES
Coloumn D -----> 5 BYTES.

Thanjs,
Raj
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jul 07, 2011 12:07 pm
Reply with quote

If you use the CODE tag when you submit your post, it will keep all your formatting.

When posting, highlight the text for your example data and click on Code button, around about the middle and above the input box.

This is Syncsort, so off to the JCL forum soon, I'd guess.
Back to top
View user's profile Send private message
prasanth_thavva

New User


Joined: 28 Jul 2005
Posts: 86
Location: Chennai

PostPosted: Thu Jul 07, 2011 12:14 pm
Reply with quote

Post ur Control card that are currently working on to acheive the result
this can be acheived using sort and sum fields
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 07, 2011 12:32 pm
Reply with quote

assume you will never have more than 999 of the same key.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
Search our Forums:

Back to Top