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
 

 

Got stuck in COBOL logic

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests
View previous topic :: :: View next topic  
Author Message
rdhupad
Currently Banned

New User


Joined: 06 May 2009
Posts: 4
Location: Pune

PostPosted: Wed Apr 21, 2010 8:34 pm    Post subject: Got stuck in COBOL logic
Reply with quote

Hi all,

I would like to find out the unmatched data from below given data. Please let me know the correct logic regarding this.I would like to take the data of two variables for matching purpose.

FILE 1 FILE 2

A A1 B B1

10 1 11 1
11 2 10 1
11 3 11 2
12 4 11 3
13 2 13 2

The logic should be like this way:--
1] File 1 is having data and one by one record of (A and A1) should check with every record(B and B1) of File 2 and if match record found then no action and if match record not found then this will be the output.

Appreciated much for valuable suggestions.

Thanks
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8121
Location: East Dubuque, Illinois, USA

PostPosted: Wed Apr 21, 2010 8:47 pm    Post subject:
Reply with quote

Sort file 1 and file 2. You then have a simple 2-way file merge process and there's code already posted to do this.

The WORST possible approach would be to read a record from file 1, open ifle 2 and read it until EOF or a match, close it, ....
This is extremely time-consuming, wasteful of resources, and not a good approach at all!
Back to top
View user's profile Send private message
rdhupad
Currently Banned

New User


Joined: 06 May 2009
Posts: 4
Location: Pune

PostPosted: Thu Apr 22, 2010 11:00 am    Post subject:
Reply with quote

Thanks for this reply.

Can you please let me know where is thie sorted code available
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Apr 22, 2010 2:35 pm    Post subject:
Reply with quote

Go to Mainframe COBOL part of the Forum, there is a sticky "2-File Match/Merge sample code ". Start from that.
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 -> HomeWorks & Requests All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am
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


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