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 

Reading Last record of VSAM directly

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


Joined: 07 Jan 2003
Posts: 16
Topics: 8

PostPosted: Wed Apr 18, 2007 4:43 am    Post subject: Reading Last record of VSAM directly Reply with quote

Hi,

Could you please let me know how I can get the last record in the VSAM file directly.
The scenario is as follows:
Have a CICS banking application, where account no: is created by adding one to the previous account no:. THe data is not stored in the DB2 tables but in VSAM. So when i need to create the new account no: , is there a way for me to reach the last record of the vsam directly and then add one to it?

Thanks and Regards,
Bindu
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Apr 18, 2007 4:53 am    Post subject: Reply with quote

Bindu,

Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?t=4151&highlight=read+last+record+vsam+directly
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12382
Topics: 75
Location: San Jose

PostPosted: Wed Apr 18, 2007 5:11 am    Post subject: Reply with quote

binduvnair,

You can start from the end of the data set by specifying a complete key of high-values(X'FF') characters on the STARTBR command. This points to the last record in the file ready for a backward browse. Once you have positioned your pointer you can issue a READPREV command. With READPREV command records are read sequentially backward from the current position.

Hope this helps...

Cheers

Kolusu

vkphani,

The link you pointed shows batch utility solutions instead of a programatic solution

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Wed Apr 18, 2007 5:11 am    Post subject: Reply with quote

Not 100% sure about this and don't have any VSAM file here set up to test this.
But try this

Move high-values to vsam-key
start file key greater than or eaqual to

read file prev
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Wed Apr 18, 2007 5:13 am    Post subject: Reply with quote

and of course Kolusu beat me by seconds

Posted: Wed Apr 18, 2007 10:11 am Post subject
Back to top
View user's profile Send private message Send e-mail 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