View previous topic :: View next topic
|
Author |
Message |
psriv20 Currently Banned New User
Joined: 25 May 2009 Posts: 19 Location: Pune
|
|
|
|
Hi,
Can we open multiple cursor in one para and fetch all in another para.finally close all of them in last para?
Ex.
Can we do like below....
Procedure Division.
INITIALISATION SECTION.
Open A
Open B
Open C
MAIN-PROCESS SECTION.
Fetch A
Fetch B
fetch C
TERMINATION SECTION.
Close A
Close B
Close C
Above question is asked to keep in mind of optimization.Is there any other way to save CPU utilisation time?
Waiting for your reply.
Thanks |
|
Back to top |
|
|
bhairon singh rathore
New User
Joined: 19 Jun 2008 Posts: 91 Location: banglore
|
|
|
|
Yes you can open them in same para.....but how will this save your CPU utilization. ....better go for tunning your queries .. |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
HI,
When you open a cursor the table is look for that moment until u have given with UR, you can optimise the query and this will save the CPU, keeping the cursor open for long time no use is wastage of resources available . you can ask for the query some one can help you in that ! |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
Ketan Varhade wrote: |
HI,
When you open a cursor the table is look for that moment until u have given with UR, you can optimise the query and this will save the CPU, keeping the cursor open for long time no use is wastage of resources available . you can ask for the query some one can help you in that ! |
what ? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
When you open a cursor the table is look for that moment until u have given with UR |
GuyC,
I imagine Ketan Varhade meant LOCK and not LOOK.
But we both know that this post is just another example of somebody talking about something of which they have no knowledge.
UR has nothing to do with locks generated by the task using UR cursor.
UR means that the locks of other tasks do not inhibit the access of Uncommited data by the task using UR.
There has been a lot of garbage written last few days about db2, locks, UR, etc. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
not just locks, also holding resources and stuff ..
dbzTHEdinosauer wrote: |
There has been a lot of garbage written last few days about db2, locks, UR, etc. |
I know, but I just point it out a little less aggressive than you ;) |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
Sorry that i meat for with hold not UR |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Suggest that you find out what WITH HOLD means. Has nothing to do with locks. |
|
Back to top |
|
|
|