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

Updating value of key using rewrite statement.


IBM Mainframe Forums -> COBOL Programming
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
ParminderKumar

New User


Joined: 03 Aug 2016
Posts: 2
Location: US

PostPosted: Thu Aug 04, 2016 12:46 am
Reply with quote

If I am using keyed read, is it possible to update value of key and rewrite the record.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Aug 04, 2016 12:54 am
Reply with quote

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

Global Moderator


Joined: 21 Sep 2010
Posts: 2572
Location: NYC,USA

PostPosted: Thu Aug 04, 2016 12:54 am
Reply with quote

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

New User


Joined: 03 Aug 2016
Posts: 2
Location: US

PostPosted: Thu Aug 04, 2016 1:07 am
Reply with quote

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

Global Moderator


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

PostPosted: Thu Aug 04, 2016 1:19 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts SKIP LOCKED DATA in UPDATE statement DB2 9
This topic is locked: you cannot edit posts or make replies. Splice JCL into one record for DD sta... SYNCSORT 2
No new posts Required Date Format in Include Sort ... DFSORT/ICETOOL 6
No new posts Updating DFSMShsm DB when objects are... JCL & VSAM 0
No new posts CALL statement in COBOL for VSE COBOL Programming 3
Search our Forums:

Back to Top