View previous topic :: View next topic
|
Author |
Message |
ParminderKumar
New User
Joined: 03 Aug 2016 Posts: 2 Location: US
|
|
|
|
If I am using keyed read, is it possible to update value of key and rewrite the record. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
No. Rewrite implies that you are updating in place -- that is, THE KEY VALUE DOES NOT CHANGE! If you are changing even a single byte of the key, you MUST use WRITE since REWRITE won't work. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Welcome!!
Why is there a need at first place to update key, one should never be doing that. This is not a cobol question though.
Code: |
For VSAM data sets, you must not change the key field in the record. |
|
|
Back to top |
|
|
ParminderKumar
New User
Joined: 03 Aug 2016 Posts: 2 Location: US
|
|
|
|
So, if by mistake I have added a record in file with wrong value of key. So, the only way to correct is to delete the record and insert a new record as we cannot update key value? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
How many times do you want to hear it? Yes, you must delete the record and write the record with the correct key as you cannot update the key value. Topic locked to prevent further questions -- you have your answer. |
|
Back to top |
|
|
|