View previous topic :: View next topic
|
Author |
Message |
venkatesh shanmugam
New User
Joined: 13 Feb 2008 Posts: 10 Location: Chennai
|
|
|
|
Hi,
I need to compare 3 files in COBOL and if the record is present in all the 3 files i need to write that record in from file1 to file 4. Can anyone please help me.. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
I would suggest using a two file match, the logic for a three way match can get very messy. Just do file1 and file2 to produce a temp1+2 matched file, then do file1+2 and file3 to produce your final matched file. There is a 2 file match program available in the forum. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
I know you said Cobol is the requirement, but I think it would be much easier using a Sort utility.
Ask the person you set the cobol requirement if Sort is acceptable.
Is in not about the results, not the method used? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
If the ONLY processing requirement is matching the keys from the 3 files, using your sort product might be easier. . . If the code requires other than the simply matching code (most/many requirements involve more than the simply match), then writing code is probably a better solution.
Near the top of the COBOL part of the forum is a "Sticky" that contains working code to accomplish a 2-file match/merge. You cluld clone this twice to first merge your file1+2 and then merge this output against file3 to generate file4. |
|
Back to top |
|
|
venkatesh shanmugam
New User
Joined: 13 Feb 2008 Posts: 10 Location: Chennai
|
|
|
|
Thank you all.... They are more specific about comparing through COBOL... I have tried coding as d.sch suggested .... But I have problem while comparing third file... I don't have access to mainframes.com in my workplace... so I 'll post the code tomorrow whichever i wrote.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
But I have problem while comparing third file... |
If the code works for file1 & file2, a very similar clone will match the 3rd file with the output from the first match. It will take 2 bits of code, not 1.
In additon to (or instead of) posting a lot of code "the problem" needs to be posted. Show a bit of sample input and the desired output from that sample input. SHow what is actually happening that is not wanted. |
|
Back to top |
|
|
venkatesh shanmugam
New User
Joined: 13 Feb 2008 Posts: 10 Location: Chennai
|
|
|
|
Hi,
I have found out the problem and rectified it... and now it is working fine.... thank you d.sch for valuable suggestions.... how to attach the doc while replying ?[/url][/code] |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for letting us know
It is better to copy/paste "things" rather than use attachments. Many of our members are not permitted to download these attachments due to security rules on their systems.
d |
|
Back to top |
|
|
venkatesh shanmugam
New User
Joined: 13 Feb 2008 Posts: 10 Location: Chennai
|
|
|
|
Ok dick scherrer.... But i have ftp the whole code... since i don't have access to the site in my office... which book can i refer if i need to know about cursor ( block, scrllable, ....)... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I do not understand this reply.
Quote: |
But i have ftp the whole code... |
Do you want to send somthing or recieve something? From where to where?
Quote: |
since i don't have access to the site in my office... |
While inconvenient, this should not cause any technical proglems. If you want to download something, use the right-click SaveAs/SaveTargetAs to copy the file to a local drive. Then copy it onto a flash drive or e-mail it as an attachment to yourself at some e-addr.
Quote: |
which book can i refer if i need to know about cursor ( block, scrllable, ....)... |
Is this a new question or is this related to the question of merging files? It sounds (to me) like database. . . |
|
Back to top |
|
|
venkatesh shanmugam
New User
Joined: 13 Feb 2008 Posts: 10 Location: Chennai
|
|
|
|
Hi d.sch,
For the first one... i meant that i have already ftp the code so can i attach it for viewing... So u can give me advice how to do it effectively...
For the last one... I shouldn't have asked the question in this post... sorry for that.. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
a mild warning concern
the program belongs to Your employer,
( developed on the employer equipment and employer time )
You should check about property, copyright and IP issues
even just posting it to have some advice/comment might be in violation of Your employer rules
so for Your wellness watch out |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
So u can give me advice how to do it effectively... |
I'm not clear on what you want to post? If you use the sample code provided, there should be no need to re-post it
Possibly, there is something i misunderstand.
Quote: |
For the last one... I shouldn't have asked the question in this post... sorry for that.. |
Not to worry
Has this been posted so that someone can provide an answer? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Hi Dick!
my understanding was that he was trying to load to the forum the program he just developed for the 3 file compare
that the reason for my warning! |
|
Back to top |
|
|
venkatesh shanmugam
New User
Joined: 13 Feb 2008 Posts: 10 Location: Chennai
|
|
|
|
hi,
enrico you are right... i was trying to do the same.... thanks enrico ... U got the point... |
|
Back to top |
|
|
venkatesh shanmugam
New User
Joined: 13 Feb 2008 Posts: 10 Location: Chennai
|
|
|
|
@ d.sch yeah, I have posted that question in DB2 forum.. |
|
Back to top |
|
|
|