|
|
| Author |
Message |
sanjay kumar tripathi
New User
Joined: 08 Jul 2008 Posts: 1 Location: chennai
|
|
|
|
| how to find common names from two input files having n names and write it into another output file? |
|
| Back to top |
|
 |
References
|
Posted: Tue Jul 08, 2008 6:04 pm Post subject: Re: how to find common names from two input files |
 |
|
|
 |
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 151 Location: PUNE(INDIA)
|
|
|
|
Sort both files on Name field
Read file 1
Read file 2
If Name_file1 = Name_file2
Perform below PARA until endofboth the files
PARA:
Write to o/p file
Read file 1
Read file 2
End-if
IF Name_file1 > Name_file2
Read file 2
End-if
IF Name_file1 < Name_file2
Read file 1
End-if |
|
| Back to top |
|
 |
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 151 Location: PUNE(INDIA)
|
|
|
|
Sorry a small mistake in earlier post :
It should be like:
Sort both files on Name field
Read file 1
Read file 2
Perform below PARA until endofboth the files
PARA:
If Name_file1 = Name_file2
Write to o/p file
Read file 1
Read file 2
End-if
IF Name_file1 > Name_file2
Read file 2
End-if
IF Name_file1 < Name_file2
Read file 1
End-if |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 7920 Location: 221 B Baker St
|
|
|
|
Hello sanjay and wecome to the forums,
| Quote: |
| how to find common names from two input files having n names and write it into another output file? |
Please post a few sample records from both files and the output you want when these files are processed.
I believe the posted code will not handle duplicates as a "hit". |
|
| Back to top |
|
 |
Anuj D.
Senior Member
Joined: 22 Apr 2006 Posts: 1923 Location: Phoenix, AZ
|
|
|
|
Hi,
As Dick has mentioned, providing your expectations with sample input/output is always good.
However, so far it seems a standard "file-matching" problem; if so, there is a sticky in the COBOL forum for such a COBOL program. With a lilttle modification you should be ready to go, here is the link...
http://ibmmainframes.com/viewtopic.php?t=22649
If this is not what you are searching for, please clarify more. |
|
| Back to top |
|
 |
|
|