Posted: Fri Feb 04, 2011 1:20 am Post subject: MATCH & UNMATCH
hi,
I've two flat files. LRECL for file1 is 100 & LRECL for file2 is 10.
I need to compare these two files on the first 10 bytes.
if they are matching, write the 10 bytes to the output file with an extra 1byte flag 'M' (denoting matching) as suffix to the output.
if the record exist in file1 and doesn't exist in file2 then, write the 10bytes to output file with 1byte extra flag 'D' (deleted from file1) as suffix to the output.
if the record doesn't exist in file1 and exists in file2 then, write the 10bytes to output file with 1byte extra flag 'I' (Insert in file2) as suffix to the output.
I'm not getting the flag(M, D,I) in the 11th position. The outputfile is created with 10bytes lenth only. Also, Is it possible to sort the output file on the first 10bytes?
I'm sorry. I gave wrong LRECL for the SORTOUT file. Your sort works fine.
If I want to sort the sortout file based on the first 10 bytes, where/how should i specify the SORT FIELDS ?
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Feb 08, 2011 11:18 am Post subject:
koolspark wrote:
I'm sorry. I gave wrong LRECL for the SORTOUT file. Your sort works fine.
Why are you specifying the LRECL? DFSORT can automatically calculate the output LRECL.
koolspark wrote:
If I want to sort the sortout file based on the first 10 bytes, where/how should i specify the SORT FIELDS ?
What makes you think the output is NOT sorted on the first 10 bytes? Since the matching is done by the key on the first 10 bytes in both files , the output is indeed sorted on that. _________________ Kolusu
www.linkedin.com/in/kolusu
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