Random Access for a KSDS file
-
- Posts: 32
- Joined: Mon Feb 27, 2012 4:44 pm
- Skillset: cobol, cics, db2, jcl
- Referer: google
Random Access for a KSDS file
while accessing a KSDS file using random access method, do we have to re initialize the pointer back to the starting position evrytime if i am accessing more than 1 record.
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: Random Access for a KSDS file
I'm going to guess "no", because I can't think of anything like that using VSAM from Cobol.
However, it is a guess because I don't really know what you are talking about.
Try not doing anything except READing. If that doesn't work for you, post your code, SELECT, FD and I/O statements, please.
However, it is a guess because I don't really know what you are talking about.
Try not doing anything except READing. If that doesn't work for you, post your code, SELECT, FD and I/O statements, please.
- mongan
- Posts: 211
- Joined: Tue Jan 11, 2011 8:32 pm
- Skillset: System Programmer
- Referer: Google searches
Re: Random Access for a KSDS file
I think your terminology is not correct. Are you talking about a read using a key, or are you talking about a start and read next scenario?
-
- Global moderator
- Posts: 3720
- Joined: Sat Dec 19, 2009 8:32 pm
- Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
- Referer: other forum
- Location: Dubuque, Iowa, USA
Re: Random Access for a KSDS file
As has been mentioned, it is difficult to tell what you are asking since your terminology is so vague.
However, since you do not have to initialize any pointer to do a random read of a KSDS file (you merely have to ensure the key contains the value you want), I'm guessing the answer is probably not.
On the other hand, if you're thinking of dynamic processing (where you randomly read a record, then use sequential processing to read the next record(s)), then you would not want to change the key since that would affect your sequential processing.
However, since you do not have to initialize any pointer to do a random read of a KSDS file (you merely have to ensure the key contains the value you want), I'm guessing the answer is probably not.
On the other hand, if you're thinking of dynamic processing (where you randomly read a record, then use sequential processing to read the next record(s)), then you would not want to change the key since that would affect your sequential processing.
-
- Posts: 32
- Joined: Mon Feb 27, 2012 4:44 pm
- Skillset: cobol, cics, db2, jcl
- Referer: google
Re: Random Access for a KSDS file
my question was that suppose i am reading a record (eg 10th record) from a KSDS file using random access method for the first time. now the second time i want to read 5th record. So in this case do we have to re initialize the pointer back to the first record again???
-
- Global moderator
- Posts: 3720
- Joined: Sat Dec 19, 2009 8:32 pm
- Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
- Referer: other forum
- Location: Dubuque, Iowa, USA
Re: Random Access for a KSDS file
It is STILL not clear what you want to know. Since you do NOT have to initialize anything to read a KSDS randomly, why would you think you do? On the other hand, if what you are doing is working then why are you posting on this forum? And if you are talking about a KSDS, why are you using terms like "10th record" and "5th record" since a KSDS is read by key value not record number -- terms that are used with RRDS files in VSAM?
If what you are doing is working, then go with it -- even if it is not the most efficient way, at least it is working. If what you are doing is not working, you're going to need to post the LISTCAT for the file (so we can see if you want KSDS or RRDS), as well as the code you are using to read the file, in order for us to help you.
If what you are doing is working, then go with it -- even if it is not the most efficient way, at least it is working. If what you are doing is not working, you're going to need to post the LISTCAT for the file (so we can see if you want KSDS or RRDS), as well as the code you are using to read the file, in order for us to help you.
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: Random Access for a KSDS file
You are talking about a VSAM KSDS on a Mainframe, we assume. We also assume you are using Cobol.
You establish a file a being a KSDS with RANDOM access.
You open the file.
You populate a key field and issue a READ for that key. You can tell that you were able to read with that key, or that you weren't.
You cannot tell which record, as far as relative sequence in the file, you read.
To read another record with a lower key, all you need to do is set up the key and issue the read. Same for a record with a higher key.
There is nothing you can set or reset relating to the KSDS (or any VSAM file).
This is why we cannot make good sense of your question.
Although you can do RANDOM access with keys in any order, where possible you should do it in key order, as the program will run better (there will be no occasion where a buffer is filled, discarded because of a lower key, and then the same data is again accessed later, so ends up being physically read again).
You establish a file a being a KSDS with RANDOM access.
You open the file.
You populate a key field and issue a READ for that key. You can tell that you were able to read with that key, or that you weren't.
You cannot tell which record, as far as relative sequence in the file, you read.
To read another record with a lower key, all you need to do is set up the key and issue the read. Same for a record with a higher key.
There is nothing you can set or reset relating to the KSDS (or any VSAM file).
This is why we cannot make good sense of your question.
Although you can do RANDOM access with keys in any order, where possible you should do it in key order, as the program will run better (there will be no occasion where a buffer is filled, discarded because of a lower key, and then the same data is again accessed later, so ends up being physically read again).
-
- Posts: 32
- Joined: Mon Feb 27, 2012 4:44 pm
- Skillset: cobol, cics, db2, jcl
- Referer: google
Re: Random Access for a KSDS file
thnks guys for ur help............. really appreciate it........
-
- Similar Topics
- Replies
- Views
- Last post
-
- 0
- 1652
-
by aarvalar1
View the latest post
Mon Sep 09, 2024 7:21 pm
-
- 1
- 1273
-
by sergeyken
View the latest post
Wed Feb 07, 2024 11:48 pm
-
-
EZIOE004 Logical I/O error on file occurred reading VB file
by savitha_y » Mon Feb 15, 2021 7:54 pm » in CA-Easytrieve - 3
- 4974
-
by savitha_y
View the latest post
Wed Feb 17, 2021 5:02 am
-
-
-
File Handling 3 input files and 1 output file by using EZT
by pavan426 » Thu Sep 09, 2021 12:17 am » in CA-Easytrieve - 0
- 4440
-
by pavan426
View the latest post
Thu Sep 09, 2021 12:17 am
-
-
-
Need to check whether file is ESDS file or not by using REXX
by Devrana » Sat Oct 05, 2024 2:28 pm » in CLIST & REXX - 6
- 3310
-
by sergeyken
View the latest post
Tue Oct 08, 2024 5:25 pm
-