Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
Saravana Manikandan

New User

Joined: 09 Aug 2011
Posts: 14
Location: India

Posted: Thu Sep 19, 2013 11:42 am    Post subject: Group records based on key and Multiply values

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

Pandora-Box

Moderator

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

 Posted: Thu Sep 19, 2013 12:02 pm    Post subject: How many records do you expect to be coming for a "Key" ?
Saravana Manikandan

New User

Joined: 09 Aug 2011
Posts: 14
Location: India

 Posted: Thu Sep 19, 2013 12:06 pm    Post subject: Each key can have a max of 31 entries
Pandora-Box

Moderator

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

 Posted: Thu Sep 19, 2013 12:46 pm    Post subject: So max of 1.e+62 ???
Saravana Manikandan

New User

Joined: 09 Aug 2011
Posts: 14
Location: India

 Posted: Thu Sep 19, 2013 1:10 pm    Post subject: 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
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Thu Sep 19, 2013 2:03 pm    Post subject: Reply to: Group records based on key and Multiply values Can you re-post representative data with expected outputs. 23*21 is not 483. You do know that SORT truncates from multiplication/dvision?
Saravana Manikandan

New User

Joined: 09 Aug 2011
Posts: 14
Location: India

Posted: Thu Sep 19, 2013 2:51 pm    Post subject:

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]
Akatsukami

Global Moderator

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

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

 Bill Woodger wrote: 23*21 is not 483

Is some non-standard notation being used?
Pandora-Box

Moderator

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

 Posted: Thu Sep 19, 2013 3:56 pm    Post subject: To me this could be handled much simpler way in Application program
Saravana Manikandan

New User

Joined: 09 Aug 2011
Posts: 14
Location: India

 Posted: Thu Sep 19, 2013 4:10 pm    Post subject: Hi Pandora-Box, That was my obvious answer! My manager for some weird reason wants this done in a sort card!
Pandora-Box

Moderator

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

 Posted: Thu Sep 19, 2013 4:52 pm    Post subject: It sounds similar to this
dick scherrer

Site Director

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

 Posted: Thu Sep 19, 2013 6:33 pm    Post subject: 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.
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

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

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 :-)
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Concatenaing multiple rows to single ... Vignesh Sid DFSORT/ICETOOL 1 Tue Aug 14, 2018 8:59 am How can we create a flat file in JAVA... jasorn Java & MQSeries 2 Wed Aug 08, 2018 3:08 pm I need to remove low values in my field shymala COBOL Programming 8 Sun Jul 29, 2018 11:15 am Copy records with unknown LRECL oerdgie DFSORT/ICETOOL 8 Tue Jul 24, 2018 7:50 pm Need Help to Create 4 Output Records ... satish.ms10 DFSORT/ICETOOL 5 Thu Jul 19, 2018 1:55 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us