Joined: 26 Nov 2002 Posts: 12358 Topics: 75 Location: San Jose
Posted: Thu Nov 16, 2017 10:17 am Post subject: Re: Need Help with Join Keys
rgcmohan wrote:
expected output
Code:
22222 DOG
33333 MAN
11111 MAT
Your input does not match the output. How come 1111 MAT is selected when it had a match in file 2?
This is your input
Code:
11111 HEN - HAS NO MATCH IN FILE2 -WRITE TO OUTPUT
22222 DOG - HAS NO MATCH IN FILE2 -WRITE TO OUTPUT
33333 COW - MATCHING RECORD - ELIMINATE
11111 RAT - MATCHING RECORD - ELIMINATE
33333 MAN - HAS NO MATCH IN FILE2 -WRITE TO OUTPUT
11111 MAT - MATCHING RECORD - ELIMINATE
/*
Ideally the output would be
Code:
11111 HEN
22222 DOG
33333 MAN
_________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Thanks for your input,We are in a process of converting ViewDirect Infopac programs to Sort.
We need to acheive the output whatever the current infopac program provides.
Infopac program logic for comparison:
Code:
FILE DDNAME PREVDAY INPUT FROM PREVDAY.$FILE_F(-1) MATCHKEY UID
FILE DDNAME CURRDAY INPUT FROM CURRDAY.$FILE_F(-0) MATCHKEY UID
REPORT DDNAME SORTOUT SKELETON RPTSORT
IF EXIST('PREVDAY')=YES&EXIST('CURRDAYT')=NO
STORE SORTOUT.UID PREVDAY.UID
STORE SORTOUT.XXX PREVDAY.XXX
STORE SORTOUT.YYYY PREVDAY.YYYY
STORE SORTOUT.NNN PREVDAY.NNN
STORE SORTOUT.RRR PREVDAY.RRR
STORE SORTOUT.CCC PREVDAY.CCC
STORE SORTOUT.TTT 'TEST'
WRITE DDNAME SORTOUT GROUP DL1
END IF
The first five column of file-1 will match with first five column of file-2.
It would not be bother about the 7,8,9 th column of file-1 or file-2.
for example:
Code:
11111 HEN first row of file-1 will match with 11111 RAT second row of file-2.
33333 COW third row of file-1 will match with 33333 COW first row of file-2.
11111 RAT fourth row of file-1 will match with 11111 MAT third row of file-2.
Better way to understand,I have modified the changes as below with ----> mark:
Code:
11111 HEN - HAS NO MATCH IN FILE2 -WRITE TO OUTPUT ----> MATCHING WITH 11111 RAT- SECOND ROW OF FILE2
22222 DOG - HAS NO MATCH IN FILE2 -WRITE TO OUTPUT ----> NO MATCHING WITH FILE2
33333 COW - MATCHING RECORD - ELIMINATE ----> MATCHING WITH 33333 COW -FIRST ROW OF FILE2
11111 RAT - MATCHING RECORD - ELIMINATE ----> MATCHING WITH 11111 MAT -THIRD RWO OF FILE2
33333 MAN - HAS NO MATCH IN FILE2 -WRITE TO OUTPUT ----> NO MATCHING WITH FILE2
11111 MAT - MATCHING RECORD - ELIMINATE ----> NO MATCHING WITH FILE2
That is how the infopac does the comparison and provides the output for no matching :
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum