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
 

 

how to get matching records in third file in cobol

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

New User


Joined: 09 May 2007
Posts: 27
Location: pune

PostPosted: Wed Aug 08, 2007 3:18 pm    Post subject: how to get matching records in third file in cobol
Reply with quote

15) file1 & file2 contains records
FILE1 FILE2 FILE3
1 2
2 4
3 6
4 7
5 8

if file1 & file 2 record matches then file3 writes matched records .(each & every record of file1 should compare with each record of file2)
Back to top
View user's profile Send private message

balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 130
Location: Guntur

PostPosted: Wed Aug 08, 2007 3:44 pm    Post subject:
Reply with quote

hi saujanya,

this topic is already discussed i think.

Code:

procedure division.
     open input infile1.
     open output outfile.
     perform read-infile-1 thru read-infile-1-exit until eof1 = 'y'
     close infile1 outfile.
     stop run.
read-infile-1.
      read infile1 at end move 'y'y to eof1.
      open input infile2.
       move 'n' to eof2.
      perform read-infile-2 thru read-infile-2-exit until eof2 = 'y'.
      close infile2.
read-infile-1-exit.
      exit.
read-infile-2.
       read infile2 at end move 'y' to eof2.
       if (val1 = val2)
           move val1 to val3
           write outrec
           move 'y' to eof2.
read-infile-2-exit.
       exit.



i didn't mentioned working-storage section,declarations should be according to the usage.
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm


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