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 two files and remving duplicates

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

New User


Joined: 23 Jul 2008
Posts: 29
Location: Little Rock - Arkansas

PostPosted: Wed Dec 17, 2008 10:52 am    Post subject: Merging two files and remving duplicates
Reply with quote

Hi,

My requirement is that :-

I have 2 files and i need to merge them as a single file and remove duplicates on them and wants to get 2 diff fields from 2 input files.

Need to remove duplicates on 1st 10 bytes on Fin date and wants GRP-SUM from 1st file and CLAIM-SUM from 2nd file for the corresponding Fin date :-

1st file :-

1-10 bytes(Fin Date) 11-15 bytes (GRP-SUM)

2008-10-01 +460.00
2008-11-01 +410.00
2008-12-01 +420.00
2008-09-01 +430.00
2008-08-01 +440.00


2nd file :-

1-10 bytes(Fin Date) 11-15 bytes (CLAIM-SUM)

2008-10-01 +360.00
2008-11-01 +310.00
2008-12-01 +320.00
2008-09-01 +330.00
2008-08-01 +340.00
2008-07-01 +340.00


O/p file :-

1-10 bytes(Fin Date) 11-15 bytes (CLAIM-SUM) 15-20 bytes (GRP-SU)
from 2nd file from 1st file

2008-10-01 +360.00 +460.00
2008-11-01 +310.00 +410.00
2008-12-01 +320.00 +420.00
2008-09-01 +330.00 +430.00
2008-08-01 +340.00 +430.00
2008-07-01 +340.00 0.00

Please help me out in this.

Thx,
satish
Back to top
View user's profile Send private message

nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Wed Dec 17, 2008 5:51 pm    Post subject:
Reply with quote

Try this code.

Code:
//S1   EXEC  PGM=ICETOOL                                       
//TOOLMSG   DD  SYSOUT=*                                       
//DFSMSG    DD  SYSOUT=*                                       
//IN1 DD *                                                     
2008-10-01 +360.00                                             
2008-11-01 +310.00                                             
2008-12-01 +320.00                                             
2008-09-01 +330.00                                             
2008-08-01 +340.00                                             
2008-07-01 +340.00                                             
/*                                                             
//IN2 DD *                                                     
2008-10-01 +460.00                                             
2008-11-01 +410.00                                             
2008-12-01 +420.00                                             
2008-09-01 +430.00                                             
2008-08-01 +440.00                                             
/*                                                             
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS) 
//OUT DD SYSOUT=*                                             
//TOOLIN DD *                                             
COPY FROM(IN1) TO(T1)                                     
COPY FROM(IN2) TO(T1) USING(CTL1)                         
SPLICE FROM(T1) TO(OUT) ON(1,10,CH) KEEPNODUPS -         
    WITHALL WITH(20,7) USING(CTL2)                       
/*                                                       
//CTL1CNTL DD *                                           
  INREC BUILD=(1,10,20:12,7)                             
/*                                                       
//CTL2CNTL DD *                                           
  OUTFIL FNAMES=OUT,IFTHEN=(WHEN=(20,7,CH,EQ,C'       '),
      BUILD=(1,18,1X,20:C'0.00   '))                     
/*


Output:
Code:
2008-07-01 +340.00 0.00   
2008-08-01 +340.00 +440.00
2008-09-01 +330.00 +430.00
2008-10-01 +360.00 +460.00
2008-11-01 +310.00 +410.00
2008-12-01 +320.00 +420.00
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Dec 17, 2008 10:37 pm    Post subject:
Reply with quote

satish kanamarlapudi,

You say your input file is only 15 bytes but the data shown exceeds that. So I am guessing that GRP-SUM and CLAIM-SUM are actually 5 byte packed decimal fields(comp-3)

Since both files are of the same length you can concatenate both files together and get the desired results

Code:

//STEP0100 EXEC PGM=ICEMAN                                           
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN=input file1,DISP=SHR                                       
//         DD DSN=input file2,DISP=SHR                                       
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  OPTION EQUALS                                                       
  SORT FIELDS=(1,10,CH,A)                                             
  OUTREC IFTHEN=(WHEN=INIT,                                           
  OVERLAY=(16:+0,TO=PD,LENGTH=5,SEQNUM,1,ZD,RESTART=(1,10))),         
  IFTHEN=(WHEN=(21,1,ZD,EQ,1),                                       
  OVERLAY=(16:11,5,11:+0,TO=PD,LENGTH=5))                             
                                                                     
  OUTFIL REMOVECC,NODETAIL,                                           
  SECTIONS=(1,10,                                                     
  TRAILER3=(1,10,TOT=(11,5,PD,PD,LENGTH=5),TOT=(16,5,PD,PD,LENGTH=5)))
/*     
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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


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