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
 

 

Comparing three Sequential file

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

New User


Joined: 15 Jul 2009
Posts: 19
Location: Chennai

PostPosted: Wed Jul 15, 2009 8:00 pm    Post subject: Comparing three Sequential file
Reply with quote

I have two sequential file having only one record each, in which the first file contains only the first four digit of telephone number and the second file contains the 10 digit telephonr number. I haev to compare the first for digit of file1 with file2, if it is existing in file2, i have to compare this with the master file which is file3 and have to write all the details of the third file in an output file. Duplication is not there. How can i compare three files, in the loop.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Wed Jul 15, 2009 8:11 pm    Post subject: Reply to: Comparing three Sequential file
Reply with quote

Quote:
I have two sequential file having only one record each


the first compare is simply a YES/NO switch...
read file1 and file2
do the compare, if the compare does not match then exit the program

at this point it is a simple issue of reading the third file an look for a match

if the third file is sorted on the key then You have a less_than/grater_than logic...

if saved key greater than file3 key keep reading
if saved key equal file3 key process the record
if saved key less than file3 key no more records to process

if file3 is not sorted then the stop will be at the end of file3
and the logic will be equal/not equal

i this is not what You intended, the practice a bit on asking questions in the proper way
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7996
Location: Bellevue, IA

PostPosted: Wed Jul 15, 2009 8:11 pm    Post subject:
Reply with quote

How many records in each file? What is the organization of the master file? Are the files sorted? What have you coded up so far (this is a help forum, after all, not a do it for you forum)? What are you comparing to file 3 -- the 4 digits from file 1 or the 10 digits from file 2?
Back to top
View user's profile Send private message
saji123

New User


Joined: 15 Jul 2009
Posts: 19
Location: Chennai

PostPosted: Wed Jul 15, 2009 8:31 pm    Post subject:
Reply with quote

Sorry i am very much fresher to this field. I will try to post messages in a proper way. To Roberts question. Have to compare the 10 digit and the master file is INDEXED. The files are not sorted.n number of records in each file
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7996
Location: Bellevue, IA

PostPosted: Wed Jul 15, 2009 9:08 pm    Post subject:
Reply with quote

Sort file 1 by all 4 digits.

Sort file 2 by the last 4 digits so file 1 and 2 can be matched easily.

There is a sticky on the COBOL forum with the 2-file match / merge solution. Once the files are sorted, you can use code from the sticky as a starting point. Once you find a match, you can do a direct read to file 3 and output.
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 splitting of file using XMITIP abdulrafi TSO/ISPF 3 Mon Mar 27, 2017 3:01 pm
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm


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