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

Question about cursor


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Amit Suri

New User


Joined: 28 Oct 2008
Posts: 25
Location: hyderabad

PostPosted: Sun Feb 13, 2011 11:53 pm
Reply with quote

Hello Everyone
Below is the Interview Question i recently faced

I have one cursor to be used in the program for retrieval of rows , so the same is declared in the working storage. Next we have opened the cursor in the procedure division to build up the result table based on the select query we have written in the Declaration part

Let's say i issue a delete statement just before the FETCH operation of
cursor. Result of that delete statement is deleting all the rows from the table

Now if i issue the Fetch Operation of the cursor, Will the Result table , that was build as part of Open cursor statement Persists? or it's deleted as well
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Feb 14, 2011 2:00 pm
Reply with quote

This forum is to see your answer and then for the other members to discuss.

What did / do you think will happen and why.

The knowledgable members will then guide you.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Feb 14, 2011 2:48 pm
Reply with quote

read about the sensitive keyword used in cursor declaration.
Back to top
View user's profile Send private message
Amit Suri

New User


Joined: 28 Oct 2008
Posts: 25
Location: hyderabad

PostPosted: Tue Feb 15, 2011 5:39 pm
Reply with quote

Thanks!

Here is what i found out
===================================
DB2 V7 introduced two types of scrollable cursors:

•SENSITIVE:— The results are updateable; the program can access data that is changed by the user or other users.

•INSENSITIVE:— Not updateable; the cursor results will not show any changes that are subsequently made to the data.
=======================================

So the answer to above questions should depend on below

If the cursor is declared as Scrollable & the cursor is declared as Sensitive Or Insensitive

If it is declared as Sensitive , the result table should reflect the changes
And if it is declared as insensitive the result table should Not be changed


P.S I was not aware of the answer but mine guess was , the result table
will remain same.
Back to top
View user's profile Send private message
singhju

New User


Joined: 01 Dec 2010
Posts: 25
Location: Gurgaon

PostPosted: Wed Feb 16, 2011 3:17 pm
Reply with quote

Hello,

If the cursor is a simple cursor means not scrollable and sensitive or insensitive. Then what will happen?

What I think is that in this case, it depends whether the qualifying rows are present on the page in bufferpool. If there are more qualifying rows on the pages in bufferpools, then fetch will get them otherwise, all rows from tables are deleted and if there are no further rows in bufferpool, the fetch operation will not get any further rows.

Experts, what's your say.
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Question for file manager IBM Tools 7
No new posts question for Pedro TSO/ISPF 2
No new posts question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
No new posts panel creation question TSO/ISPF 12
No new posts Sort w/OUTREC Question DFSORT/ICETOOL 2
Search our Forums:

Back to Top