View previous topic :: View next topic |
Author |
Message |
binduvnair Beginner
Joined: 07 Jan 2003 Posts: 16 Topics: 8
|
Posted: Wed Apr 18, 2007 4:43 am Post subject: Reading Last record of VSAM directly |
|
|
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 |
|
 |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
Posted: Wed Apr 18, 2007 5:11 am Post subject: |
|
|
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 |
|
 |
Sreejith Intermediate
Joined: 02 Dec 2002 Posts: 155 Topics: 25 Location: N.Ireland
|
Posted: Wed Apr 18, 2007 5:11 am Post subject: |
|
|
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 |
|
 |
Sreejith Intermediate
Joined: 02 Dec 2002 Posts: 155 Topics: 25 Location: N.Ireland
|
Posted: Wed Apr 18, 2007 5:13 am Post subject: |
|
|
and of course Kolusu beat me by seconds
Posted: Wed Apr 18, 2007 10:11 am Post subject |
|
Back to top |
|
 |
|
|