You need to do a better job of explaining the "rules". You seem to show a pattern file2 that has 2-character strings that can appear anywhere in file1. Does any match of characters from file2 in file1 mean you want that file1 record for output? We have no way of knowing if file2 can only have a single 2-character string in each record, or different length strings in each record, or multiple strings in each record or what. You need to be very specific about what file2 can look like and what you're trying to match in file1 from file2.
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
In addition to posting better "rules", it would be a big help if you posted more realistic sample data rather than alphabet soup. If your real data must not be disclosed, fine, but realistic sample data can still be posted.
If you explain the business requirement, i believe it will be much more understandable to all who read this.
Thanks for the input, please find the details below
1. pattern file i.e. File2 can have multiple records but one line would only contain one single pattern and would be unique within the file File2, the length of the same could also be varying [even though file is FB hence remaining would be spaces]
2. the pattern can occur anywhere within a record in File1 and there may be more than one pattern lying in a record
in the above case record 3 of File1 has 2 patterns in it so the intermediate step in JCL may return this record twice but at the end the final file Out1 would be sorted uniquely.
Out2 would be prepared after final Out1 has been sorted then Out2 would be difference between File1 and Out1
3. the search for each pattern has to be an exact search for ex File1 may have records like
You haven't defined the rules of the pattern. How did you pick only record 3 from file 1 has a pattern? Unless you come with up clear cut rules of picking the pattern , there is nothing that we can help you with. You are better off writing a program.
Thanks for the reply...
record 3 of File1 has multiple matching patterns in it [as per Rule 2]
there isn't a fixed position where the pattern may or may not occur in File1.
its like searching on Windows in a particular folder all the files [here records in File] with "A word or phrase in the file [here each record of File2]"
Yes, programming wise its like
Read till end of File2
for each record of File2
Read till end of File1
for each record of File1
if strstr(Rec_File1,Rec_File2) [searches for occurence of string
Rec_File2 in string Rec_File1]
returns FOUND then write Rec_File1 in Out1
for-loop end for File1
for-loop end for File2
sort Out1 and compare Out1 & File1, report records not in Out1 but existing in File1 to Out2
but my concern was if File1 is very big then it could be time consuming to do the same programmatically; hence looking for DFSORT solution.
Please let me know if the rules are ok now