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 KSDS sequential indexed file randomly

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


Joined: 29 Apr 2005
Posts: 10
Topics: 6

PostPosted: Mon Mar 16, 2009 2:06 am    Post subject: Read KSDS sequential indexed file randomly Reply with quote

Hi,

Can anyone tell me whether we can read a KSDS VSAM sequential indexed file randomly.

consider my FD is

SELECT B-INPUT ASSIGN TO FILEIN
ACCESS MODE IS SEQUENTIAL
ORGANIZATION IS INDEXED
RECORD KEY IS B-REC-SEQ
FILE STATUS W23-B-STATUS.

consider my I/P record is

1
2
3
4
5
6

I am reading the file from 1-5 and after I read 5th record I need to read the records again from 2 to 6. Is it possible.

Regards,
Karthik.
Back to top
View user's profile Send private message
computer
Beginner


Joined: 12 Jun 2007
Posts: 64
Topics: 17
Location: Hyderabad

PostPosted: Mon Mar 16, 2009 6:01 am    Post subject: Reply with quote

Hi,

As we have 'ACCESS MODE IS SEQUENTIAL' for the file, we cannot do random read for file, I suppose. So we can't read a file first sequentially then randomly......

Where as if we define the file's access method as DYNAMIC, then we can do a sequential read by setting the key randomly.

Anybody please correct me if I am wrong.

Thanks,
Manoj
Back to top
View user's profile Send private message
dilip_rath
Beginner


Joined: 05 Sep 2007
Posts: 1
Topics: 0
Location: India

PostPosted: Mon Mar 16, 2009 6:09 am    Post subject: Reply with quote

@Karthik

It seems you want to access a file both sequentially as well as Randomly. To do this you have to change your FD section and make it "ACCESS MODE IS DYNAMIC".

If you decalre a file with ACCESS MODE SEQUENTIAL the only way you can read it is Sequentially.

By declaring it as DYNAMIC in FD Section, You can read it sequentially by using the READ statement without KEY and use the KEY in READ statement, when you want to read RANDOMLY.

-Dilip
Back to top
View user's profile Send private message Yahoo Messenger
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