ICETOOL - Matching 2 files with duplicates help



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

ICETOOL - Matching 2 files with duplicates help

Postby denis.dhimitri » Fri May 23, 2008 4:57 pm

Hello Mr.Yaeger,

My requirement is:
INPUT 1 has no duplicates:
DENIS 01 AAA
MARCO 01 XXX
PAOLO 01 YYY

INPUT 2 has duplicates:
DENIS 01 CCC
DENIS 02 CCC
DENIS 03 CCC
MARCO 01 CCC
MARCO 02 CCC
MARCO 03 CCC
PAOLO 01 CCC
PAOLO 02 CCC
JONNY 01 CCC
JONNY 02 CCC
JONNY 03 CCC
JONNY 04 CCC

Desired OUTPUT-1 file with all matched records:
OUTPUT 1:
DENIS 01 AAA
MARCO 01 XXX
PAOLO 01 YYY

Desired OUTPUT-2 file with all NON matched records from INPUT 2:
OUTPUT 2:
JONNY 01 CCC
JONNY 02 CCC
JONNY 03 CCC
JONNY 04 CCC


I tryed to match 2 INPUT files to produce 1-st Output for all matched records and 2-nd Output for all non matched records from the 2-nd INPUT file:
//MATCH EXEC PGM=ICETOOL
//*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
DENIS 01 AAA
MARCO 01 XXX
PAOLO 01 YYY
//IN2 DD *
DENIS 01 CCC
DENIS 02 CCC
DENIS 03 CCC
MARCO 01 CCC
MARCO 02 CCC
MARCO 03 CCC
PAOLO 01 CCC
PAOLO 02 CCC
JONNY 01 CCC
JONNY 02 CCC
JONNY 03 CCC
JONNY 04 CCC
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(1,25)),DISP=(MOD,PASS)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(WK01)
COPY FROM(IN2) TO(T1) USING(WK02)
SPLICE FROM(T1) TO(OUT) ON(1,5,CH) WITH(26,1) USING(WK03) -
KEEPNODUPS
//WK01CNTL DD *
INREC OVERLAY=(25:C'11')
//WK02CNTL DD *
INREC OVERLAY=(25:C'22')
//WK03CNTL DD *
OPTION EQUALS
OUTFIL FNAMES=OUT,INCLUDE=(25,2,CH,EQ,C'12'),BUILD=(1,24)
OUTFIL FNAMES=OUT1,INCLUDE=(25,2,CH,EQ,C'22'),BUILD=(1,24)


The result of all matched records in OUTPUT 1 was correct:
OUTPUT 1:
DENIS 01 AAA
MARCO 01 XXX
PAOLO 01 YYY

The result of all non matched records in OUTPUT 2 was not correct:
OUTPUT 2:
JONNY 01 CCC

How can I get the desired OUTPUT 2 with all duplicates keeping the same result for OUTPUT 1 ? Help me out to deal with this problem please.

Best regards
Denis Dhimitri
denis.dhimitri
 
Posts: 11
Joined: Sat Feb 09, 2008 9:11 pm
Has thanked: 0 time
Been thanked: 0 time

Re: ICETOOL - Matching 2 files with duplicates help

Postby skolusu » Fri May 23, 2008 9:51 pm

Denis Dhimitri,

You asked a similar question before and a solution was provided here

dfsort-icetool-icegener/topic644.html#p2458

why wouldn't you use the same logic provided in there? Either way here is a DFSORT/ICETOOL JCL which will give you the desired results. It uses the same logic as mentioned in the other thread

//STEP0100 EXEC PGM=ICETOOL                                  
//TOOLMSG  DD SYSOUT=*                                        
//DFSMSG   DD SYSOUT=*                                        
//IN1      DD *                                              
DENIS 01   AAA                                                
MARCO 01   AAA                                                
PAOLO 01   AAA                                                
//IN2      DD *                                              
DENIS 01 CCC                                                  
DENIS 02 CCC                                                  
DENIS 03 CCC                                                  
MARCO 01 CCC                                                  
MARCO 02 CCC                                                  
MARCO 03 CCC                                                  
PAOLO 01 CCC                                                  
PAOLO 02 CCC                                                  
JONNY 01 CCC                                                  
JONNY 02 CCC                                                  
JONNY 03 CCC                                                  
JONNY 04 CCC                                                  
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT1     DD SYSOUT=*                                        
//OUT2     DD SYSOUT=*                                        
//TOOLIN   DD *                                        
  COPY FROM(IN1) USING(CTL1)                          
  COPY FROM(IN2) USING(CTL2)                          
  SPLICE FROM(T1) TO(OUT1) ON(1,5,CH) -                
  WITHALL WITH(01,24) KEEPBASE KEEPNODUPS USING(CTL3)  
//CTL1CNTL DD *                                        
  OUTFIL FNAMES=T1,BUILD=(1,5,19X'FF',1,5)            
//CTL2CNTL DD *                                        
  OUTFIL FNAMES=T1,BUILD=(1,24,5X)                    
//CTL3CNTL DD *                                        
  OUTFIL FNAMES=OUT1,BUILD=(01,24),                    
  INCLUDE=((1,5,CH,EQ,25,5,CH),AND,6,1,CH,NE,X'FF')    
  OUTFIL FNAMES=OUT2,BUILD=(01,24),                    
  INCLUDE=(6,1,CH,NE,X'FF',AND,25,5,CH,EQ,C' ')        
/*
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: ICETOOL - Matching 2 files with duplicates help

Postby denis.dhimitri » Wed May 28, 2008 4:26 pm

hi Skolusu,

Sorry but I thought that the logic on the topic dfsort-icetool-icegener/topic644.html#p2458 couldn't be used in this case. Thank you very much for the solution you provided me. Next time I'll be more careful in posting questions.

Best regards
Denis Dhimitri
denis.dhimitri
 
Posts: 11
Joined: Sat Feb 09, 2008 9:11 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post