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: 8200
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: 1827
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: 8200
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 data from one file to other!!! Vignesh Sid SYNCSORT 1 Mon Nov 06, 2017 2:42 pm
No new posts Updating multiple counts in trailer!! Vignesh Sid SYNCSORT 4 Mon Nov 06, 2017 1:04 pm
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm

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