IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

STARTBR and DELETE in CICS


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Wed May 12, 2010 7:54 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed May 12, 2010 8:20 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed May 12, 2010 8:33 pm
Reply with quote

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
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Wed May 12, 2010 8:44 pm
Reply with quote

Thank you all
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Calling an Open C library function in... CICS 1
No new posts How to 'Ping' a CICS region in JCL CICS 2
Search our Forums:

Back to Top