Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Compare 2 file in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Fri Aug 07, 2009 11:09 am    Post subject: Compare 2 file in COBOL
Reply with quote

Hi
I have 2 files

FILE1
ACCNO
11111
22222
44444
55555

FILE2
ACCNO
11111
33333
44444
55555
66666
77777

I need to compare 2 files and write output fie whaich have in the Account No in both the files.

i need to write it throughcobol program
Can any one please help me on this....

Thanks in adv...

Sashi.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Aug 07, 2009 11:12 am    Post subject:
Reply with quote

Why waste time doing this in COBOL when the solution already exists using your SORT product.

What is the absolute must for using COBOL. How long will it take you to spec, code, test, amend, retest a program when the solution can be found in about 2 minutes in the DFSORT forum.
Back to top
View user's profile Send private message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Fri Aug 07, 2009 11:18 am    Post subject:
Reply with quote

Can you please tell how to get this through JCl?/
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Aug 07, 2009 11:21 am    Post subject:
Reply with quote

/RANT ON
Once more let us clarify exactly what JCL is.

it is Job Control Language.

By itself it does nothing. It is used to invoke the chosen program and to define which datasets are to be used by the DD names associated with the chosen program.

JCL does not have magical powers that solve all problems, JCL is merely the vehicule for telling the processor which program you want it to execute.
/RANT OFF

As suggested above, please search the DFSORT forum. There are a lot of examples in there and I for one have my own work to do rather than search on your behalf.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Fri Aug 07, 2009 12:31 pm    Post subject:
Reply with quote

Quote:
please search the DFSORT forum
Or even the JCL forum for SyncSort JOIN which does the same if your shop has SyncSort. icon_smile.gif

But is there any other processing involved like database reads/updates? Is yes, it would be better to go with a COBOL solution.
Back to top
View user's profile Send private message
arindambanerjee

New User


Joined: 30 Jun 2007
Posts: 39
Location: India

PostPosted: Fri Aug 07, 2009 3:06 pm    Post subject: Reply to: Compare 2 file in COBOL
Reply with quote

Hi sashi,

Using COBOL the solution is something like this:
step1:
As both the files are sorted u need not have to do a sort in asc order. So u may ignore this step.

Step2:

Procedure division:
Perform this para until end of (file1 or file2)
Evaluate true
WHEN (file1-ACCNO > FILE2-ACCNO)
read file 2
WHEN (file1-ACCNO < FILE2-ACCNO)
read file1
WHEN (file1-ACCNO = FILE2-ACCNO)
write output file
End-Evaluate.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Aug 07, 2009 7:54 pm    Post subject:
Reply with quote

Hello,

Near the top of the cobol part of the forum is a "Sticky" that contains working code for a 2-file match/merge.

Suggest you look there as this does exactly what you are looking for icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us