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

Group records based on key and Multiply values


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Global Moderator


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

PostPosted: Thu Sep 19, 2013 12:02 pm
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
Reply with quote

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

Global Moderator


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

PostPosted: Thu Sep 19, 2013 12:46 pm
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
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

Moderator Emeritus


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

PostPosted: Thu Sep 19, 2013 2:03 pm
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
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: 1788
Location: Bloomington, IL

PostPosted: Thu Sep 19, 2013 2:53 pm
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

Global Moderator


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

PostPosted: Thu Sep 19, 2013 3:56 pm
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
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

Global Moderator


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

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

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

Moderator Emeritus


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

PostPosted: Thu Sep 19, 2013 6:33 pm
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

Moderator Emeritus


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

PostPosted: Thu Sep 19, 2013 7:32 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 5
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 Pulling a fixed number of records fro... DB2 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top