IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can we RESET the file pointer in VSAM


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
neeharika

New User


Joined: 23 May 2008
Posts: 14
Location: Hyderabad

PostPosted: Mon Oct 06, 2008 1:00 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Oct 06, 2008 1:05 pm
Reply with quote

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
View user's profile Send private message
neeharika

New User


Joined: 23 May 2008
Posts: 14
Location: Hyderabad

PostPosted: Mon Oct 06, 2008 1:11 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Oct 06, 2008 1:56 pm
Reply with quote

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
View user's profile Send private message
neeharika

New User


Joined: 23 May 2008
Posts: 14
Location: Hyderabad

PostPosted: Mon Oct 06, 2008 2:08 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Oct 06, 2008 4:37 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Oct 06, 2008 4:41 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 5
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top