View previous topic :: View next topic |
Author |
Message |
computer Beginner
Joined: 12 Jun 2007 Posts: 64 Topics: 17 Location: Hyderabad
|
Posted: Wed Feb 04, 2009 2:25 am Post subject: key generation in VSAM (KSDS) file |
|
|
Hi,
My requirement is that, on daily basis we receive some records which we need to add into our master file.(KSDS)
The present method we are following is....we Read the master file till the EOF and then from last record key value we generate new key. This is very tedious and time consuming.
So, is there any way to go directly to last record of a vsam KSDS file.
Key layput - KEY 12 A
I used the following logic,
KEY = ' 9999999999'
(Since this the maximum value that i can have for this key. The first 2 bytes are mandatorly spaces)
Then issued the following command,
POINT file LE KEY status
but it throws error as 'PARAMETER IS INVALID - LT '
Note:
1. Its a VSE environment.
2. It should be done in EasyTrieve language
Thanks in advance for any help....
Manoj |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Feb 04, 2009 7:00 am Post subject: |
|
|
you could keep an all 99999999999999 or high-value record,
that you could read directly,
would maintain the last/highest customeer number used.
you could implement RESTART with the data portion of this record.
Does not matter what you add/insert,
KSDS will always build the data portion adding the new records after the last.
The keys will be ordered in the Index.
Only a reorg can reorder the data portion. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Wed Feb 04, 2009 4:12 pm Post subject: |
|
|
Follow the dinosaur's advice for storing the last used key. You might consider adding it on a record with the lowest key value rather than the highest. Adding it as the highest might increase CI/CA splits because VSAM would always want to insert records into the last CI with the highest key.
dbz, I'm thinking that your response isn't entirely accurate. VSAM will attempt to insert records into the appropriate CI for KSDS. If KSDS only added at the end, we wouldn't have CI/CA splits. It's been a while, so forgive me if I'm blowing smoke... |
|
Back to top |
|
 |
expat Intermediate

Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
|
Posted: Thu Feb 05, 2009 2:01 am Post subject: |
|
|
Inserting records with a higher key value than the highest available would not cause any CI/CA splits.
It sounds to me that the application logic is somewhat lacking when you have to manually generate KSDS keys for data. Not being a programmer maybe someone could explain how would a user retrieve data by key if he has no idea of what the key is  _________________ If it's true that we are here to help others,
then what exactly are the others here for ? |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Feb 05, 2009 4:13 am Post subject: |
|
|
jsharon1248,
your idea of a low-value 'control record' is much better than a high-value key.
and you are correct of course about splits for inserts. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
computer Beginner
Joined: 12 Jun 2007 Posts: 64 Topics: 17 Location: Hyderabad
|
Posted: Thu Feb 12, 2009 5:50 am Post subject: |
|
|
Hi,
I followed the concept of storing the 'last key used' in another file. And each time take the refrence of this file for key generation at the start and updating the last key generated at the end of operation.
But i did not get this one 'your idea of a low-value 'control record' is much better than a high-value key'.
Can anybody please explain me what was about this "low-value 'control record' " method.
Thanks,
Manoj |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Feb 12, 2009 8:49 am Post subject: |
|
|
instead of a separate file to control your vsam, use the first record of your vsam file as a control - using low-values as the key. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
|
|