Page 1 of 1

removing duplicate of second file

PostPosted: Thu Dec 22, 2016 9:30 pm
by arya_starc
I have two files, in one file I have some inputs which are duplicates in some position and in second file I have some records.
I need records in output file which not contains all that record which present in the second file.

example file 1
001 5827 34
002 5456 24
003 5456 27
004 2463 28
005 2463 25
006 2463 24

file 2

444 1234 23
234 1345 23
234 2463 21


expected output:

001 5827 34
002 5456 24
003 5456 27


As in have only from position 4 to 8 which is having common data in both the files.

Re: removing duplicate of second file

PostPosted: Fri Dec 23, 2016 3:53 am
by BillyBoyo
It's a simple JOINKEYS with the key, specifying JOIN UNPAIRED,F!,ONLY, you'll need to also SORT in the maintask to get the data back into your original key order (001/002/003).

Re: removing duplicate of second file

PostPosted: Sat Dec 24, 2016 3:45 pm
by arya_starc
BillyBoyo wrote:It's a simple JOINKEYS with the key, specifying JOIN UNPAIRED,F!,ONLY, you'll need to also SORT in the maintask to get the data back into your original key order (001/002/003).


Hi BillyBoyo
Thanks for giving info

I tried with unpaired joined and keeping f1 file only, on running it will give the return code 16. Below is the code

000028   SORT FIELDS=COPY                      
000029   JOINKEYS FILE=F1,FIELDS=(20,19,A)      
000030   JOINKEYS FILE=F2,FIELDS=(20,19,A)      
000031   JOIN UNPAIRED,F1,F2                    
000032   REFORMAT FIELDS=(F1:1,16104)          
 


getting this error message code


ICE411I 0 THIS IS THE JOINKEYS MAIN TASK FOR JOINING F1 AND F2                  
ICE416I 0 JOINKEYS IS USING THE F1 SUBTASK FOR SORTJNF1 - SEE JNF1JMSG MESSAGES
ICE416I 1 JOINKEYS IS USING THE F2 SUBTASK FOR SORTJNF2 - SEE JNF2JMSG MESSAGES
ICE419I 0 JOINED RECORDS: TYPE=F, LENGTH=16104                                  
ICE201I 0 RECORD TYPE IS F - DATA STARTS IN POSITION 1                          
ICE805I 1 JOBNAME: JTHTEZT1 , STEPNAME: STEP020                                
ICE802I 0 BLOCKSET     TECHNIQUE IN CONTROL                                    
ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5650-ZOS, Z/OS DFSORT V2R1  - 17:12 ON SAT DE
            SORT FIELDS=COPY                                                    
            JOINKEYS FILE=F1,FIELDS=(20,19,A)                                  
            JOINKEYS FILE=F2,FIELDS=(20,19,A)                                  
            JOIN UNPAIRED,F1,F2                                                
            REFORMAT FIELDS=(F1:1,16104)                                        
ICE043A 8 INVALID DATA SET ATTRIBUTES: SORTOUT  BLKSIZE - REASON CODE IS 06    
ICE751I 0 C5-I21470 C6-BASE   C7-K96411 C8-I25275 E7-I22412                    
ICE052I 3 END OF DFSORT                                                        
 

Re: removing duplicate of second file

PostPosted: Sat Dec 24, 2016 7:42 pm
by NicC
What have you tried to in order to fix this? What is the JCL for the SORTOUT DD statement?

Re: removing duplicate of second file

PostPosted: Mon Jan 02, 2017 5:44 am
by arya_starc
Thanks guys,

Now it is working. Below is the code.

000098 //SYSIN    DD  *                                                        
000099   SORT FIELDS=COPY                                                      
000100   JOINKEYS FILES=F1,FIELDS=(15,24,A)                                    
000101   JOINKEYS FILES=F2,FIELDS=(1,24,A)                                    
000102   JOIN UNPAIRED,F1,ONLY    
 

previously might be I using join and reformat at a same time.