View previous topic :: View next topic
|
Author |
Message |
neeharika
New User
Joined: 23 May 2008 Posts: 14 Location: Hyderabad
|
|
|
|
Hi,
I have to update some records in the flat file with the values in VSAM File.
VSAM file key is defined on 6 fields But I can provide only first 4 fields(Short key) at the time of access from my Flat file.
So Iam doing a START with GTEQ option and doing a READ NEXT. I have to update the records in the Flat file only if there is one record in the VSAM file for the Short key.
My problem here is..There are multiple records in the flat file with the same short key..So when iam accessing VSAM for the first record in flat file it is pointing to the correct record on the VSAM. But when I want to access the same record again later for 2nd record in the Flat file..Iam unable to do so as the START is not pointing to the correct record now. Can I RESET the file pointer every time after accessing the VSAM file? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
yes,
sounds as if this is a simple match-update; that means you only advance your vsam when your trigger (qsam) is greater than current vsam. |
|
Back to top |
|
|
neeharika
New User
Joined: 23 May 2008 Posts: 14 Location: Hyderabad
|
|
|
|
Hi,
Iam advancing VSAM if there is a match..But there is a situation like I need to point the same record in VSAM again as there can be duplicates in my Flat file..So can I reset the File pointer after every update and before accessing the VSAM again.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You need to re-read thr previous reply
Quote: |
that means you only advance your vsam when your trigger (qsam) is greater than current vsam |
Quote: |
Iam advancing VSAM if there is a match |
Don't do that. Do what was suggested. There is no need to reset/re-read. |
|
Back to top |
|
|
neeharika
New User
Joined: 23 May 2008 Posts: 14 Location: Hyderabad
|
|
|
|
Hi Dick,
Thanks..But I need to ensure that there is only one record for the provided short key( 4 fields) in the VSAM file. So after pointing to the desired record iam reading until the short key change inorder to get the count. Only if there is one record iam doing changes to Flat file.
But as there are duplicates in my Flat file I may require the same VSAM record again. So Please suggest me how can I achieve this. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
As long as you're just reading the VSAM file, why not use a second DD name, SELECT, and FD for the VSAM file -- and use the full key to read the second file once you've found the right short key record? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
why are you not noticing that the current 'short-key' is the same as the previous,
which means you already have your info for the qsam update,
thus saving additional unneeded I/O? |
|
Back to top |
|
|
|