Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Updating value of key using rewrite statement.

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Updating value of key using rewrite statement.
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: 7913
Location: Bellevue, IA

PostPosted: Thu Aug 04, 2016 12:54 am    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Thu Aug 04, 2016 12:54 am    Post subject:
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    Post subject: Reply to: Updating value of key using rewrite statement.
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: 7913
Location: Bellevue, IA

PostPosted: Thu Aug 04, 2016 1:19 am    Post subject:
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.    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Updating online Db2 table kishpra DB2 3 Fri Aug 12, 2016 2:44 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us