Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 8401
Location: Dubuque, Iowa, 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: 2038
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: 8401
Location: Dubuque, Iowa, 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 Calling and updating SAS Macro variab... Yogesh Jaiswal All Other Mainframe Topics 2 Thu Oct 11, 2018 12:37 pm
No new posts Create view statement from SYSIBM.SYS... andrea DB2 5 Thu Aug 02, 2018 9:30 pm
No new posts CA SYSVIEW - MQTHRESH updating dynami... Anilkumarmq CA Products 2 Fri Jun 08, 2018 2:06 pm
No new posts Dynamically updating the MQ monitorin... Anilkumarmq Java & MQSeries 0 Fri Jun 08, 2018 2:05 pm
No new posts Compute statement with Cobol Z/os 5.2 Chetan Kumar COBOL Programming 2 Fri May 11, 2018 8:02 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us