MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Read sequential file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Sat Aug 16, 2003 1:34 am    Post subject: Read sequential file Reply with quote

Hi all,

Iam reading a sequential file and my pointer is say in the 10th record. How can i reset the pointer to 1st record...

Please suggest...

I cannot close and open the file again Sad

Thanks,
Deep
Back to top
View user's profile Send private message AIM Address
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Sat Aug 16, 2003 2:04 am    Post subject: Reply with quote

Just now i saw a post by Prayank .....he too had the same requirement...
Prayank can u tell me how you solved your problem....

I have two sorted seq files say F1 and F2. I need to take out the matched records

F1 , LRECL = 15 (the file is sorted with first 3 char)
123ABCDEFGHNNNN
345FDFDSFSDNNNH
567FDSFDFDSFJUIK
678FDFDFDFDSFDS

F2, LRECL = 10 (the file is sorted with first 3 char)
123YTUYFGR
222TRYUIOP
300FDFDFDF
345LKJLK45
678RRER78


I need to match the first 3 characters only and then fetch only them into a file F3

O/P SHUD BE LIKE

F3

123
345
678

I have to do this in cobol and not using SORT or any other utility(its a requirement).....

Any thoughts....

Thanks,
Deep
Back to top
View user's profile Send private message AIM Address
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12401
Topics: 75
Location: San Jose

PostPosted: Sat Aug 16, 2003 7:21 am    Post subject: Reply with quote

deepeshk79,

please check this topic. It has SORT, COBOL, EASYTRIEVE solutions.

http://www.mvsforums.com/helpboards/viewtopic.php?t=11

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vkrishna2001
Beginner


Joined: 07 Aug 2003
Posts: 46
Topics: 18
Location: Danbury

PostPosted: Fri Aug 22, 2003 10:33 am    Post subject: Reply with quote

Here is a simple solution. This makes the assumption that both files are sorted on the same key in ascending order irrespective of the position of the key in both the files.

Read file1 and file2
Compare the key of file1 with key of file2. Assume that key of file1 is key1 and key of file2 is key2
If key1 is = key2 then write the key to output file and read file1 and file2
If key1 is > key2 then read file2 until key1 = key2 or key1 < key2
If key1 < key2 then read file1 until key1 = key2 or key1 > key2

This needs to be done until end of file1 or end of file2.

Thanks,
Vijayakrishna
Back to top
View user's profile Send private message Send e-mail
hari_uss
Beginner


Joined: 19 Dec 2002
Posts: 78
Topics: 6
Location: Trivandrum, India

PostPosted: Sun Aug 24, 2003 6:09 pm    Post subject: Reply with quote

Or,

If you have a relatively small file, which can be pushed to Working storage,

Read FILE1(smaller) sequentially and store it in a working storage table.
Read FILE2,
For each read, SEARCH the key value in WS table.
If found match, write it out,
Continue till end of FILE2.

Hari.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group