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
 

 

Merging records & multiplication

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

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Mon Oct 08, 2007 5:45 pm    Post subject: Merging records & multiplication
Reply with quote

Hi all,

I'm stuck on a problem. I think DFSORT/ICETOOL can solve it but I don't know how. Hope you can help.

Here what I try to do:

Layout of the example file:

In:
Code:
-keyA-  -Qty--  --keyB--  --Coeff--
CCCC   20,02     
AAAA   22,04   XXXX           3     
BBBB   30,00   
BBBB   20,00   
EEEE   10,00
AAAA   07,10   XXXX           3



I would like as output to sum the Qty per KeyA and merge those with same key. But, when a record has KeyB associated, KeyA should be replaced by keyB (a conversion key), and the Qty transformed (multiplied) by the associated Coeff.

So, for the above input, the output should be:

Code:
--key- --Qty--
CCCC   20,02     
XXXX   87,42
BBBB   50,00   
EEEE   10,00


Thank you very much!

Julien.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Oct 08, 2007 9:36 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what I think you want.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
CCCC   20,02
AAAA   22,04   XXXX           3
BBBB   30,00
BBBB   20,00
EEEE   10,00
AAAA   07,10   XXXX           3
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=(16,4,CH,NE,C' '),
    OVERLAY=(1:16,4,8:8,5,UFF,MUL,30,2,ZD,EDIT=(TT,TT)))
  SORT FIELDS=(1,4,CH,A)
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(1,4,
      TRAILER3=(1,4,8:TOT=(8,6,UFF,EDIT=(TT,TT))))
/*


Code:

BBBB   50,00   
CCCC   20,02   
EEEE   10,00   
XXXX   87,42   


If you want the output records in their original input order, let me know and I'll show you how to do that.
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Tue Oct 09, 2007 1:40 pm    Post subject:
Reply with quote

That's exactly what I want to do.
Didn't know this would be so simple.

Thank you very much.

Julien
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 Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


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