Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Question about cursor

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: Question about cursor
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: 8593
Location: Back in jolly old England

PostPosted: Mon Feb 14, 2011 2:00 pm    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Mon Feb 14, 2011 2:48 pm    Post subject:
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    Post subject: Reply to: Question about cursor
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts question about dfsms management clas... Hervey Martinez IBM Tools 0 Tue Oct 10, 2017 6:19 pm
No new posts Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am
No new posts Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm
No new posts QUESTION: RETURN CHANNEL pahiker CA Products 21 Thu Apr 20, 2017 12:31 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us