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: 8088
Location: East Dubuque, Illinois, USA

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: 1720
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: 8088
Location: East Dubuque, Illinois, USA

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 a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts CICS Question RE: Browse, Readnext an... moezbud CICS 7 Sun Mar 05, 2017 5:45 am
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am


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