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

STARTBR after 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 Jun 09, 2010 5:24 pm
Reply with quote

Hi ,

I am reading a KSDS and if that record matches some criteria i need to delete it fro the KSDS and then continue reading the KSDS till EOF.

My logic:

I read the ksds seuentially after a start brws , and then if i have to delete a record , i store the KEY in a working storage variable , and then delete the record followed by an end browse . Agian i give a start browse with the stored Key andd GTEQ option and cotinue my process till EOF .

Problem :
It works fine , now the problem is for the last record, when i reach the last record , i deleted and gave a start browse again , instead of getting a CICS response 20 (EOF) i am getting 13 (row not found) .


Could explain me the funda why it happens so ? (KSDS is intiallized to low values )
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Wed Jun 09, 2010 5:43 pm
Reply with quote

Hi,

Please refer the manual for STARTBR command

As per the manual, it clearly says the given below are the error conditions for STARTBR
Quote:
Conditions: DISABLED, FILENOTFOUND, ILLOGIC, INVREQ,
IOERR, ISCINVREQ, LOADING, NOTAUTH, NOTFND, NOTOPEN, SYSIDERR
The ENDFILE condition that you are expecting will never be returned by the STARTBR command...
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 Jun 09, 2010 5:52 pm
Reply with quote

This is bad practice. A STARTBR, READNEXT, ENDBR, DELETE, STARTBR could cause a deadlock when the file is defined to LSR (Local Shared Resource) but, if it is not LSR defined (known as NSR - Non Shared Resource) the VSAM CRP (Current Record Pointer, under the covers), at the very least, has the potential to lose track as to where it's at in the file.

In other words, don't mix Random access with Sequential access unless you fully understand the pitfalls and consequences.

A different method is recommended....

Bill
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Wed Jun 09, 2010 5:54 pm
Reply with quote

Thanks Binop
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Wed Jun 09, 2010 6:01 pm
Reply with quote

Bill ,

Thanks for the response , but am not sure i understand why you recomend this method not to be used. I am not sure i understand the harm , could you please ellobrate with an example / if you could suggest an alternative it would be of great help .

Thanks
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Wed Jun 09, 2010 6:05 pm
Reply with quote

Use READNEXT statement with UPDATE option, and DELETE the record then and there .... You will not have to ENDBR and do random access every time ...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Jun 09, 2010 6:16 pm
Reply with quote

Terminology note: terminology is critical in IT, where similar words may mean very different things. Your statement that a response code 13 is "row not found" is not only incorrect, it has negative implications. Files have records, not rows. Databases have rows. Stating that you didn't get any rows would send a support person looking towards a database problem, not a code issue or VSAM problem.
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 Jun 09, 2010 6:19 pm
Reply with quote

Binop,

There isn't a READNEXT command with UPDATE. The OP would need to ENDBR, save the current key, READ for UPDATE, DELETE and issue another STARTBR, using the saved-key (GTEQ) in the RIDFLD. Because the saved-key record had been deleted, VSAM should point the CRP at the record following the deleted record (EIBRESP=ZERO) or raise a NOTFND condition (effectively EOF).

This is the safest method to avoid deadlock's and/or messing up the CRP when combining Random and Sequential access together.

Bill
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Wed Jun 09, 2010 6:27 pm
Reply with quote

Hi Bill,

Am not sure if i missed anything...
Was referring to this link ... Here the READNEXT is available with the UPDATE option ...
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 Jun 09, 2010 6:47 pm
Reply with quote

Binop,

Yes, I read the LINK and (much to my surprise), a READNEXT with UPDATE is now offered. However, it is only available under RLS (Record Level Sharing).

I don't get to code too much anymore, so my apologies.

I think the OP needs to review the usage of this command together with or without RLS. The following link may help -

VSAM Demystified -

www.redbooks.ibm.com/redbooks/pdfs/sg246105.pdf

Bill
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 Jun 09, 2010 7:13 pm
Reply with quote

Quote:
"Files have records, not rows. Databases have rows. Stating that you didn't get any rows would send a support person looking towards a database problem, not a code issue or VSAM problem".

Robert,

Can't count the number of times you've explained and posted this.

Seems like nobody pays any attention and posters continue to perpetuate this mismatch of terminology....

Bill
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Jun 09, 2010 7:36 pm
Reply with quote

Bill:

And I can't count the number of times terms have been misused on this forum, causing responders to look in one direction, when the actual problem was in a different area that the correct terminology would have helped identify earlier. Yet the posters get mad when told their lack of correct terminology is causing the delay in answering!
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Thu Jun 10, 2010 2:11 am
Reply with quote

Quote:
The OP would need to ENDBR, save the current key, READ for UPDATE, DELETE and issue another STARTBR, using the saved-key (GTEQ) in the RIDFLD. Because the saved-key record had been deleted, VSAM should point the CRP at the record following the deleted record (EIBRESP=ZERO) or raise a NOTFND condition (effectively EOF).


Bill's recommendation is the industry standard.

Just do it, and move on with your work..
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Jun 10, 2010 4:27 am
Reply with quote

Robert Sample wrote:
And I can't count the number of times terms have been misused on this forum, causing responders to look in one direction, when the actual problem was in a different area that the correct terminology would have helped identify earlier. Yet the posters get mad when told their lack of correct terminology is causing the delay in answering!
Robert, I sometimes think you are out on a crusade, a modern day IT Don Quixote, the man of La Mancha....... icon_lol.gif
FWIW, I don't know what other 'responders' read into some of the clues we get, but row/record and column/field (and to some extent, sort/jcl) are fairly much interchangeable in my mind, depending upon the data structure.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Thu Jun 10, 2010 4:38 am
Reply with quote

If our "senior" people do not insist on proper terminology, who will.

If we let slop get by, we're "aiding and abetting". . .

From what i can tell, most of the new people would prefer to "say it right", but if their teachers, managers, and the seniors they interact with are not going to insist, they may go a long time not even knowing that their choice of words makes them look ignorant, lazy, and sloppy.

Quite often "wrong wording" causes confusion and makes a topic get ugly because people are not on the same page. Using improper terms is also quite unprofessional. It has also cost people a job they were being considered for.

When i mess up, i'm thankful when someone tells me. . . Many/most new people are also.

d
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Jun 10, 2010 7:14 am
Reply with quote

I was working one place where someone who interviewed claimed he could code in "COBALT". Whether or not that was true, the boss decided if the person was unable to properly identify the language being used, he could not hire the person. So I have personal experience that improper terminology keeps people out of jobs.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Jun 10, 2010 7:56 am
Reply with quote

dick scherrer wrote:
If our "senior" people do not insist on proper terminology, who will.
IIRC, some of those 'senior people' had their heads up their **es, I learned in that environment for a while, and it did promote a feeling of failure.
Quote:
If we let slop get by, we're "aiding and abetting". . .
Why let 'slop' get by, an insistence to proper terminology does not always require a slap on the head.
Quote:
From what i can tell, most of the new people would prefer to "say it right", but if their teachers, managers, and the seniors they interact with are not going to insist, they may go a long time not even knowing that their choice of words makes them look ignorant, lazy, and sloppy.
Saying it right is a good thing, but understanding (in this forum environment) what is being said and asked is on us 'senior people' to get past the minor affronts of the misuse of terminology and provide pointers, solutions and advice for solutions and correct terminology.
Quote:
Quite often "wrong wording" causes confusion and makes a topic get ugly because people are not on the same page. Using improper terms mis also quite unprofessional. It has also cost people a job they were being considered for.
Common sense is the biggest tool we 'senior people' can bring to this forum. Any 'wrong wording' I've seen has only caused confusion among the less experienced people, and that is where Moderators come into play. The Moderators duty is to correct the 'wrong wording' in a way that does not bit**-slap the poster. I have mentored a number of (what turned out to be) good programmer/analysts and ridicule and scorn was not one of my teaching tools.
Quote:
When i mess up, i'm thankful when someone tells me. . . Many/most new people are also.
Dropped into a three man VSE shop as a COBOL/Assembler junior programmer and handed the systems responsibility the next month when he quit, my PSR taught me more through guidance and example than through scorn and I still maintain those standards.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jun 10, 2010 8:04 am
Reply with quote

Robert Sample wrote:
I was working one place where someone who interviewed claimed he could code in "COBALT". Whether or not that was true, the boss decided if the person was unable to properly identify the language being used, he could not hire the person. So I have personal experience that improper terminology keeps people out of jobs.
Some 30 or 40 years ago, I had a neighbor, a teenage high school senior, tell me that he thought the 'via' (Telstar) satellite was really neat, he really thought its name was 'via' because that is what he saw in a corner of his TV screen. I wondered then what is the future going to be like?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 10, 2010 2:46 pm
Reply with quote

well one benefit of knowing correct terminology is that you
can find things when you search thru manuals.
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Fri Jun 11, 2010 3:17 am
Reply with quote

Quote:
IIRC, some of those 'senior people' had their heads up their **es, I learned in that environment for a while, and it did promote a feeling of failure.


I've worked with a lot of 'senior people' , but I must admit, I have never seen any of them with their head up their **es.

That must have been quite a sight and could definitely lead to a sense of failure if one was to attempt emulation.
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 Associating a USERID with a CICS-Libe... CICS 0
No new posts omegamon for cics -UNSUPPORTED ENVIRO... CICS 2
No new posts Help needed in automation cics transa... CLIST & REXX 1
No new posts How to Login in to cics region and is... CICS 9
No new posts Spoolopen cics CICS 0
Search our Forums:

Back to Top