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

Merging records & multiplication


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


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

PostPosted: Mon Oct 08, 2007 9:36 pm
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
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 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 8
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 Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top