View previous topic :: View next topic |
Author |
Message |
computer Beginner
Joined: 12 Jun 2007 Posts: 64 Topics: 17 Location: Hyderabad
|
Posted: Mon Dec 20, 2010 2:03 am Post subject: Few Queries on Cursors - DB2 |
|
|
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 |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Mon Dec 20, 2010 2:26 am Post subject: |
|
|
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 |
|
 |
computer Beginner
Joined: 12 Jun 2007 Posts: 64 Topics: 17 Location: Hyderabad
|
Posted: Mon Dec 20, 2010 7:11 am Post subject: |
|
|
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 |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Mon Dec 20, 2010 9:36 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
|
|