Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Group records based on key and Multiply values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Saravana Manikandan

New User


Joined: 09 Aug 2011
Posts: 14
Location: India

PostPosted: Thu Sep 19, 2013 11:42 am    Post subject: Group records based on key and Multiply values
Reply with quote

Hi,

Below is my requirement:

Input File:

Code:
Key Number
A    2   
A   11   
A   22   
B   23   
B   21   

The Value of the field "Number" can be max of 100

Desired Output:
Code:
A               484 (product of all values under "A" in input 2*11*22)
B               483 (product of all values under "B" in input 23*21)

Please can you help me with this?

Data corrected
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Sep 19, 2013 12:02 pm    Post subject:
Reply with quote

How many records do you expect to be coming for a "Key" ?
Back to top
View user's profile Send private message
Saravana Manikandan

New User


Joined: 09 Aug 2011
Posts: 14
Location: India

PostPosted: Thu Sep 19, 2013 12:06 pm    Post subject:
Reply with quote

Each key can have a max of 31 entries
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Sep 19, 2013 12:46 pm    Post subject:
Reply with quote

So max of 1.e+62 ??? icon_eek.gif
Back to top
View user's profile Send private message
Saravana Manikandan

New User


Joined: 09 Aug 2011
Posts: 14
Location: India

PostPosted: Thu Sep 19, 2013 1:10 pm    Post subject:
Reply with quote

Hi Pandora,

Sorry about the confusion. I should have given the inputs correctly, my bad.

We are actually trying to acheive this formula:

(1+r1)*(1+r2)*(1+r3)...(1+rn) - 1

where 1<n<31 & -0.1<r<+0.1

So to answer your question each value will range between "-1.1 to +1.1" and max of 31 entries.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Thu Sep 19, 2013 2:03 pm    Post subject: Reply to: Group records based on key and Multiply values
Reply with quote

Can you re-post representative data with expected outputs.

23*21 is not 483.

You do know that SORT truncates from multiplication/dvision?
Back to top
View user's profile Send private message
Saravana Manikandan

New User


Joined: 09 Aug 2011
Posts: 14
Location: India

PostPosted: Thu Sep 19, 2013 2:51 pm    Post subject:
Reply with quote

Hi Bill,

Reposting with the representative data:

Input:
Code:
Key Number
A   0.20   
A   0.11   
A   0.22   
B   0.23   
B   0.21   

The max number of occurrences for a particular "Key" can be 31
The value of "Number" ranges from -1 to +1

Desired output:
(1+r1)*(1+r2)*(1+r3)...(1+rn) - 1

Code:
A               0.63 --> [(1+0.2)*(1+0.11)*(1+0.22) - 1]
B               0.49 --> [(1+0.23)*(1+0.21) - 1]
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Sep 19, 2013 2:53 pm    Post subject: Re: Reply to: Group records based on key and Multiply values
Reply with quote

Bill Woodger wrote:
23*21 is not 483

Is some non-standard notation being used?
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Sep 19, 2013 3:56 pm    Post subject:
Reply with quote

To me this could be handled much simpler way in Application program
Back to top
View user's profile Send private message
Saravana Manikandan

New User


Joined: 09 Aug 2011
Posts: 14
Location: India

PostPosted: Thu Sep 19, 2013 4:10 pm    Post subject:
Reply with quote

Hi Pandora-Box,

That was my obvious answer! My manager for some weird reason wants this done in a sort card! icon_sad.gif
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Sep 19, 2013 4:52 pm    Post subject:
Reply with quote

It sounds similar to this icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Sep 19, 2013 6:33 pm    Post subject:
Reply with quote

Hello,

Might your manager be able to provide some guidance?

Keep in mind if someone does come up with a complicated solution, your manager will be stuck with maintaining it. It is not likely you will be in that job forever.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Thu Sep 19, 2013 7:32 pm    Post subject: Re: Reply to: Group records based on key and Multiply values
Reply with quote

Akatsukami wrote:
Bill Woodger wrote:
23*21 is not 483

Is some non-standard notation being used?


Mmmm... my caluclator strongly disagrees with me. I bow to superior knowledge and experience :-)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us