I have two flat files of same record length and same file layout. I need to create an output file with records of the first file whose key(position 81-100 byte) is not found in the second file. In other words, I should create an output file by removing the records from the first file whose key is available in the second file. The second file may contain duplicate keys. The key is in the same byte location (81-100) in both the files. Is there any simple way using JCL SORT to do this?
If you need more specific help than that DFSORT Trick provides, show an example of the records in each input file (relevant fields only) and what you expect for output. Also, give the RECFM and LRECL of each input file.
I have created the sample Input files and the output file that is needed for me. It will be great if you could assist me in getting this done through JCL SORT. Please find the details below. Thanks for your time and assistance.
All files are of LRECL=300 and RECFM=FB. The key(20 byte) is available in the byte position (81 ? 100) in all the files. The first input file does not contain duplicate key but the second input file may or may not contain duplicate keys. (Only keys may be duplicate in the second file but the records wont be duplicate). The output file should contain records as it is from the first file by removing the record keys found in second file.
The second column in the following example case is the 20 byte key.
Input File 1
20060101 01CE2006VIPSNM567893 DATA...
20050425 01FH2005VIPSNM876561 DATA...
20050317 01GT2005VIPSNM089334 DATA...
20050205 01FH2005VIPSNM847244 DATA... Key Match 1 .Do not copy
20060521 01PS2006VIPSNM524357 DATA...
20050511 01VB2005VIPSNM083424 DATA... Key Match 2 .Do not copy
Output File contain records from Input File 1 without any matched keys in Input File 2.(i.e.,) All matched key records are removed from File 1 and written to output file. In this example case, the fourth and sixth records of input file 1 has matching key in input file 2. So, those two records are removed from the input file 1 and written to output file.