MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Few Queries on Cursors - DB2

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
computer
Beginner


Joined: 12 Jun 2007
Posts: 64
Topics: 17
Location: Hyderabad

PostPosted: Mon Dec 20, 2010 2:03 am    Post subject: Few Queries on Cursors - DB2 Reply with quote

Hi,

The cursor functionality in a cobol program goes this way:
-- Declare Cursor : Definition of the query
-- Open Cursor: Cursor gets executed and the pointer is set to first record in the cursor result
-- Fetch Cursor: Data retrieve happens and populated to host variables
-- Close cursor: closing the cursor

I have following few questions:
1. What happens in this following case....
Open Cursor1
Fecth Cursor1

Open Cursor1
Fetch Cursor1
Close Cursor1

2. If have 50 records to display on the screen, 10 max at a time...
So, which is better option to go for
a) Use of TSQ and store all the records and then send 10 recs at a time to screen. or,
b) Use of inbuilt DB2 scrollable functionality.

(Do not have strobe access to analyze performance for the above)

Thanks in Advance,
Computer
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Mon Dec 20, 2010 2:26 am    Post subject: Reply with quote

storing data in a tsq is handy, especially if you KNOW that all will be accessed.

There are size restrainsts (the more cics memory you use for your transaction, the less there is available for others.

There is also the problem (required logic) to delete the queue items when the transaction is complete.

you are only displaying 10 items per screen - invocation of the program.
the cursor will be closed after your program issues the cics return.

what are the requirements of your transaction? to only provide scrollablility to data,
or
can a user jump from page 1 to page 3?

answers to above will help in determining your logic.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
computer
Beginner


Joined: 12 Jun 2007
Posts: 64
Topics: 17
Location: Hyderabad

PostPosted: Mon Dec 20, 2010 7:11 am    Post subject: Reply with quote

dbzTHEdinosauer,

My requirement is only to display the data in forward/backward sequence.

And one more thing, we have a convention of deleting all the TSQs created once the master transaction program terminates.

Also, any thoughts on Query-1.

Thanks In Advance
Computer
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Mon Dec 20, 2010 9:36 am    Post subject: Reply with quote

i would save the last keys in dfhcommarea and not use the tsq.

i would always close the cursor within the program.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Dec 20, 2010 12:42 pm    Post subject: Reply with quote

computer,

You need to understand the concept of Pseudo conversation. Read about it here

http://publib.boulder.ibm.com/infocenter/cicsts/v2r2/index.jsp?topic=/com.ibm.cics.ts22.doc/dfhp3/dfhp35g.htm

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group