View previous topic :: View next topic |
Author |
Message |
karthikbabudh Beginner
Joined: 29 Apr 2005 Posts: 10 Topics: 6
|
Posted: Mon Mar 16, 2009 2:06 am Post subject: Read KSDS sequential indexed file randomly |
|
|
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 |
|
|
computer Beginner
Joined: 12 Jun 2007 Posts: 64 Topics: 17 Location: Hyderabad
|
Posted: Mon Mar 16, 2009 6:01 am Post subject: |
|
|
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 |
|
|
dilip_rath Beginner
Joined: 05 Sep 2007 Posts: 1 Topics: 0 Location: India
|
Posted: Mon Mar 16, 2009 6:09 am Post subject: |
|
|
@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 |
|
|
|
|