Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 10327
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: 8165
Location: East Dubuque, Illinois, USA

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: 8165
Location: East Dubuque, Illinois, USA

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 Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us