Comparing 2 files using JOIN KEYS



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Comparing 2 files using JOIN KEYS

Postby borneng2005 » Wed Jan 16, 2013 11:43 pm

Hi,

Could you please let me know if the below requirement can be accomplished using Join Keys in SORT. Basically, i wanted to compare the key of 1st file with the 2nd file and if the key matches, write records from 2nd file to output. In this case, my key is first 7 bytes from both the input file.


File -1:
1111111xxxx
2222222yyyy
4444444zzzz


File-2:
1111111aaaa
1111111bbbb
1111111cccc
2222222aaaa
2222222bbbb
3333333aaaa
3333333bbbb
4444444aaaa

Output file:
1111111aaaa
1111111bbbb
1111111cccc
2222222aaaa
2222222bbbb
4444444aaaa
borneng2005
 
Posts: 2
Joined: Wed Jan 16, 2013 11:32 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Comparing 2 files using JOIN KEYS

 

Re: Comparing 2 files using JOIN KEYS

Postby skolusu » Wed Jan 16, 2013 11:54 pm

borneng2005,

use the following DFSORT JCL which will give you the desired results.

//STEP0100 EXEC PGM=SORT                   
//SYSOUT   DD SYSOUT=*                     
//INA      DD *                             
1111111aaaa                                 
1111111bbbb                                 
1111111cccc                                 
2222222aaaa                                 
2222222bbbb                                 
3333333aaaa                                 
3333333bbbb                                 
4444444aaaa                                 
//INB      DD *                             
1111111xxxx                                 
2222222yyyy                                 
4444444zzzz                                 
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                             
  OPTION COPY                               
  JOINKEYS F1=INA,FIELDS=(1,7,A)           
  JOINKEYS F2=INB,FIELDS=(1,7,A)           
  REFORMAT FIELDS=(F1:1,80)                 
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Comparing 2 files using JOIN KEYS

Postby borneng2005 » Thu Jan 17, 2013 12:16 am

Hi Kolusu,

Thanks a lot for your quick response. The Sort card works like a charm. :)
borneng2005
 
Posts: 2
Joined: Wed Jan 16, 2013 11:32 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post