Page 1 of 1

File Comparision.

PostPosted: Wed Aug 13, 2014 11:56 pm
by Vineet
Hi All,
I am having 2 Sequential File A & B, both having LRECL = 80 & RECFM = FB. I want to compare both the Files for the 80 Bytes (Complete Record Length). If Record is Present in File A but not in File B then record to be written to O/P file, similarly if record is present in File B but not in File A record to be written to O/p File. If Record is present in Both the Files record to be bypassed. O/P file having LRECL = 80 & RECFM = FB. How to handle this using SORT. belos is example for Same.

File A:
123456789|ABCDEFGH|1234OPLKM
444444444|ABCDEFGH|1111OPLKM ----> To Be Written To O/p File
555555555|ABCDEFGH|2222OPLKM ----> To Be Written To O/p File
666666666|ABCDEFGH|13333PLKM
777777777|LOMNVP12|98765AQNO ----> To Be Written To O/p File


File B:
123456789|ABCDEFGH|1234OPLKM
444444444|ABCD1234|1111OPLKM ----> To Be Written To O/p File
555555555|ABCD4444|2222OPLKM ----> To Be Written To O/p File
666666666|ABCDEFGH|13333PLKM

Thanks

Re: File Comparision.

PostPosted: Thu Aug 14, 2014 1:16 am
by BillyBoyo
JOINKEYS, specify SORTED,NOSEQCK if the data is indeed in order as you show. Key of 80. JOIN UNPAIRED,ONLY. Specify a REFORMAT statement with the match-marker (?) something like this =(F1:1.80,F2:1,80,?)

Then you can test which unmatched record you got, to source the data for a BUILD statement,