View previous topic :: View next topic |
Author |
Message |
vak255 Intermediate
Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
Posted: Fri Sep 17, 2004 4:35 am Post subject: Alternate to 'Read with Update and rewrite' |
|
|
normally we got to do READ with UPDATE before REWRITE.Is there any other way to LOCK the record and directly REWRITE it.why i have to READ a record- is that the only way to make sure that it is available,what if i know that the file is available.Pls show me a the other way. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Fri Sep 17, 2004 4:50 am Post subject: |
|
|
vak225,
You need to tell us the environment you are trying to rewrite. Is it in Batch cobol or CICS?
You cannot update a record directly without reading it, unless you are talking of updating a record in a DB2 table.
If you are trying to update a record in a file, then just code DISP=OLD in the JCL and the file will be available ONLY for your application. CICS has an exclusive control of the vsam files, so it is like coding DISP=OLD in batch environment.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
vak255 Intermediate
Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
Posted: Fri Sep 17, 2004 5:53 am Post subject: |
|
|
kolusu,
The Environment : CICS
When i got all the necessay details for updating a record whats the necessary for reading it, before updation.
As far as I know we have to read a record before updation.
Direct rewrite should be faster and efficient.when Direct delete is possible why can't direct REWRITE??? |
|
Back to top |
|
|
vak255 Intermediate
Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
Posted: Fri Sep 17, 2004 6:50 am Post subject: |
|
|
kolusu,
I forgot to mention that Iam using KSDS dataset. |
|
Back to top |
|
|
warp5 Intermediate
Joined: 02 Dec 2002 Posts: 429 Topics: 18 Location: Germany
|
Posted: Mon Sep 20, 2004 1:09 am Post subject: |
|
|
You must be sure that the record that you are going to update has not been changed before updating it - if you do not prevent access to the record before processing it then someone may update it before you do and then your update will destroy the previous update - that is why you must read and lock the record and then update it. The usual process is you read the record, display it for alterations, read it again and log it and check if it has been modified since the last read (check if somebody else has updated it), then update it. |
|
Back to top |
|
|
|
|