Rewrite without prior read with update



Support for CICS/ESA, CICS/TS & Transaction Gateway, CICS Configuration Manager and CICS Performance Analyzer

Rewrite without prior read with update

Postby pulsar22 » Wed Nov 06, 2013 4:36 pm

Hi,

Can we rewrite a record in a file withour readin that record with update option, by just mentioning the record key.
pulsar22
 
Posts: 34
Joined: Mon Sep 09, 2013 12:39 pm
Has thanked: 14 times
Been thanked: 0 time

Re: Rewrite without prior read with update

Postby Robert Sample » Wed Nov 06, 2013 5:42 pm

What did the CICS Application Programming Reference manual tell you when you looked up the REWRITE command?
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Rewrite without prior read with update

Postby dick scherrer » Wed Nov 06, 2013 10:57 pm

Hello,

Do read the manual for a better understanding.

But logically, how might you update something you don't "have" . . .

Are you trying to save some overhead? If so (and there are mostly adds rather than updates) try to add the record and if it is a duplicate, then read and update. If the process is mostly updaes, read then update.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Rewrite without prior read with update

Postby pulsar22 » Thu Nov 07, 2013 4:19 pm

Yes, the program manual told that a rewrite should be done after read of the record to be modified, but my doubt is why can't we edit/rewrite a record directly by mentioning record key like we do in case of delete.
pulsar22
 
Posts: 34
Joined: Mon Sep 09, 2013 12:39 pm
Has thanked: 14 times
Been thanked: 0 time

Re: Rewrite without prior read with update

Postby BillyBoyo » Thu Nov 07, 2013 5:14 pm

Because, as the manual has indicated, that is the way that it works. If there was a REPLACE you might expect it to work like you want.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Rewrite without prior read with update

Postby Robert Sample » Thu Nov 07, 2013 5:53 pm

why can't we edit/rewrite a record directly by mentioning record key like we do in case of delete
Because the manual tells you that this cannot be done. That is the reason why -- if you want to know more about the reasons behind this restriction, you can ask IBM but don't be surprised if they refuse to tell you (if they even know after so many years).
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Rewrite without prior read with update

Postby c62ap90 » Thu Nov 07, 2013 11:04 pm

The UPDATE parameter in the READ first verifies existence of record and if so, then puts your record in exclusive-use for updating fields/data.

As to why not REWRITE? Well, it won't work.
c62ap90
 
Posts: 125
Joined: Thu Oct 11, 2012 10:24 pm
Has thanked: 1 time
Been thanked: 7 times

Re: Rewrite without prior read with update

Postby dick scherrer » Thu Nov 07, 2013 11:22 pm

And this is Not a problem - it is a feature.

This has been the way for a very long time and i suspect it will not change in my time with IT . . . ;)
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to CICS

 


  • Related topics
    Replies
    Views
    Last post