Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 MXG - Processing Compressed DB2 SMF r... vasanthz All Other Mainframe Topics 2 Thu May 10, 2018 12:47 am
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Merge 2 records sancraig16 SYNCSORT 19 Tue Mar 27, 2018 8:17 pm
No new posts Copy set of records based on condition krish.deepu SYNCSORT 2 Thu Mar 08, 2018 11:39 am
No new posts add sequence number for duplicate rec... SRUTHI DRAVIDAMANI COBOL Programming 11 Thu Feb 22, 2018 5:37 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us