View previous topic :: View next topic
|
Author |
Message |
cvishu
Active User
Joined: 31 Jul 2007 Posts: 136 Location: india
|
|
|
|
Hi ,
I have a requirement , where i need to keep reading a VSAM (KSDS) sequentially and check for a condition , if the read record satisfies the condition i need to remove the record from the VSAM and continue with the Next record , If i reach the End of FIle , i will issue a delay restart and repeat the whole process again.
My Doubts :
I do a STARTBR and use read next to do the sequential read.
Now can i delete the record simply by using the key and continue with readnext , or
should i issue a ENDBR and store the Key and DELETE and then again STARTBR using the key and continue
Please advice |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
From the CICS Programming Guide manual (link at the top of the page), section 4.2.1.2:
Quote: |
To end the browse, use the ENDBR command. There is no RIDFLD for this command. Trying to browse past the last record in a file raises the ENDFILE condition. You must issue the ENDBR command before performing an update operation on the same file (a READ UPDATE, DELETE with RIDFLD, or WRITE command). If you do not, you get unpredictable results, possibly including deadlock within your own transaction. |
|
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
If the file is defined to LSR and you issue a STARTBR, READNEXT and then a DELETE before issuing an ENDBR, you're going to have big trouble, as the CRP (Current Record Pointer) will lose its mind and/or (as Robert has posted from the IBM manual), cause a deadlock.
Besides, IBM highly discourages this sequence.
I first encountered a program in the mid 1980's which was doing this (we were running CICS/OS 1.6.1 at the time) and it was a royal PITA to debug.
So, don't do this....
Bill |
|
Back to top |
|
|
cvishu
Active User
Joined: 31 Jul 2007 Posts: 136 Location: india
|
|
|
|
Thank you all |
|
Back to top |
|
|
|