At a recent roadshow here in the UK, I made what is about the ONLy bold
statement I've ever made about DB2.
I stated that I couldn't think of a single circumstance when a programmer
wouldn't know whether to code FOR FETCH ONLY or FOR UPDATE OF when
declaring a cursor - but of course I also said I was sure there'd be
exceptions. As yet, none of the expected exceptions have come to mind.
So......
Can anyone suggest a GOOD reason for not coding one of the above clauses on
cursor definitions, mainly for my own interests.
Cheers
Phil Grainger
Product Consultant
PLATINUM technology UK
If I have "join/subquery/order by/group by" etc etc. Why do I code FOR
FETCH ONLY ?
They are unambiguously "FOR FETCH ONLY", Does DB2 higher versions still
consider them unambiguous cursor ?
I guess there is no GOOD reason for not coding "FOR FETCH ONLY" .
Unfortunately programmers forget coding extra line especially they feel
they have more important things to worry about and performance is the last
issue.
I have seen I/O parallelism taking effect in all those kind (join/order by
etc) of cursor without coding "FOR FETCH ONLY". Probably DB2 (V4.1) does
not consider them as ambiguous cursor
Pillay
-------------
Original Text
From: grai...@PLATINUM.CO.UK, on 2/17/98 3:11 PM:
Discussion of "ambiguous cursors" has been driving me crazy lately;
should we rewrite all of our cursors where we do not use "FOR UPDATE
OF" to say "FOR FETCH ONLY" so as to make them unambiguous?
After further research, it appears that DB2 only considers a cursor
to be ambiguous if the cursor is not READ-ONLY (based on the SQL provided:
no ORDER BY, JOINs, etc), and there is DYNAMIC SQL in the program.
Our shop is entirely mainframe static SQL based. Teaching the developers
about "FOR FETCH ONLY" is not a bad idea, but the precompiler/bind
process will not generate any ambiguous cursors in our case. If we
add it to our "standard", developers will believe that they have to
change existing code when performing maintenance. Not necessarily
a bad idea, but the old adage "If it ain't broke, don't fix it" may
apply...
I agree that all Client-Server based applications processing dynamic
SQL (through an ODBC layer, for example) without bound packages/plans
should ALWAYS specify "FOR FETCH ONLY" or "FOR UPDATE OF"; this, however,
would fall under a "standard" that applies when dynamic SQL is in use.
Please let me know whether I am incorrect in my statement regarding
"ambiguous" cursors.
Regards,
Jon Heinecke
Senior Technical Specialist
Compuware Corporation
Opinions expressed are my own, and do not necessarily reflect those
of my client or employer.
=================================================
I also feel it better documents the cursor to the full intent of the
cursor. Sure it's a little more typing to do but I'd rather take the
extra few key strokes and be certain what DB2 will do.
Michael Bancale
TFBIC
Only my opinions, not the companies.
On Tue, 17 Feb 1998, Venkat R. Pillay wrote:
> Phil
>
> If I have "join/subquery/order by/group by" etc etc. Why do I code FOR
> FETCH ONLY ?
> They are unambiguously "FOR FETCH ONLY", Does DB2 higher versions still
> consider them unambiguous cursor ?
>
> I guess there is no GOOD reason for not coding "FOR FETCH ONLY" .
> Unfortunately programmers forget coding extra line especially they feel
> they have more important things to worry about and performance is the last
> issue.
>
> I have seen I/O parallelism taking effect in all those kind (join/order by
> etc) of cursor without coding "FOR FETCH ONLY". Probably DB2 (V4.1) does
> not consider them as ambiguous cursor
>
> Pillay
> -------------
> Original Text
> From: grai...@PLATINUM.CO.UK, on 2/17/98 3:11 PM:
"After further research, it appears that DB2 only considers a cursor
to be ambiguous if the cursor is not READ-ONLY (based on the SQL
provided:
no ORDER BY, JOINs, etc), and there is DYNAMIC SQL in the program."
I believe this to be the case for distributed processing. However I
believe that local static programs with a non-read only cursor which has
no declare "for .." statement to be ambiguous.
Like you, please let me know if this statement is incorrect.
thank
Willie
> -----Original Message-----
> From: Jon Heinecke [SMTP:Jon.He...@MCI.COM]
> Sent: Tuesday, February 17, 1998 9:43 PM
> To: DB...@AMERICAN.EDU
> Subject: Ambiguous Cursors - A cursory(!) question
>
>
> *** Warning : this message originates from the Internet ***
> Just a quick one for all you 'real world' people out there.
>
> At a recent roadshow here in the UK, I made what is about the ONLy
> bold
> statement I've ever made about DB2.
>
> I stated that I couldn't think of a single circumstance when a
> programmer
> wouldn't know whether to code FOR FETCH ONLY or FOR UPDATE OF when
> declaring a cursor - but of course I also said I was sure there'd be
> exceptions. As yet, none of the expected exceptions have come to mind.
>
> So......
>
> Can anyone suggest a GOOD reason for not coding one of the above
> clauses on
> cursor definitions, mainly for my own interests.
>
> Cheers
>
> Phil Grainger
> Product Consultant
> PLATINUM technology UK
Legal disclaimer : The opinions expressed in this message are those of the
sender and not those of The Royal Bank of Scotland plc
Gotta a weird one. At least for us. At service level 9712 (and I think at 9708)
we started getting REASON=X'00E50013' for different DB2 utilities including COPY,
RECOVER and REORG.
A sysprog traced it to subpool 229 which I believe is above the line. Apparently
the error is caused by a failing GETMAIN. Anyway, these problems are intermittent
yet serious enough to prevent some maintenance from occuring.
We have 2 gig of c stor and db2 buffers taking up 400 mb. Data warehouse
environment.
Is anyone else experiencing this?
Any ideas, opinions, guesses very appreciated.
Thanks alot,
Jerry Bustamente
Lands' End
--------------------------------------------------------------------------
00E50013
Explanation: A DB2 execution unit has been abended. This abend code must
ultimately be issued by resource managers when the CANCEL exit
is driven as a result of a suspend request.
This abend reason code is issued by the following CSECTs:
+------------------------------------------------------------------------+
¦ DSNVEUS1 ¦ DSNVEUS3 ¦ DSNVASTM ¦ DSNVCST0 ¦
¦ DSNVDST0 ¦ DSNVFEB ¦ DSNVSLT0 ¦ DSNVSUL0 ¦
¦ DSNVXLT0 ¦ ¦ ¦ ¦
+------------------------------------------------------------------------+
System Action: The agent cancel processing continues.
Operator Response: Notify the system programmer only if the abend results in the
termination of the DB2 subsystem.
System Programmer Response: This reason code may be issued as a result of any
connected TCB abend, or operator -STOP DB2
MODE(FORCE) command. No further action is required.
The recovery routine for the CSECT issuing this reason code records information in
the variable recording area (VRA). If you suspect an error in
DB2, refer to Section 3 of Diagnosis Guide and Reference for information on
identifying and reporting the problem.
Problem Determination: If DB2 abends, examine the SVC dump to determine the
suspended resource manager and the state of the failing
subcomponent. For example, the ACEMC (must complete) bit should be off.
Collect the following diagnostic items listed in Appendix B, "Problem
Determination" in topic B.0: 1, 2, 5.
Phil Grainger
PLATINUM technology UK
rpo...@R.IMAP.ITD.UMICH.EDU on 18/02/98 12:36:59
Please respond to DB...@AMERICAN.EDU
To: DB...@AMERICAN.EDU
cc: (bcc: Phil J Grainger/Pti)
Subject: Re: Ambiguous Cursors - A cursory(!) question
Marcus
PS: Of course, I'm still one of the lazy ones that don't code for fetch only,
but hey,
it's the thought that counts!
> ---------------------------------------------------------------
>
> Name: PIC00361.PCX
> Part 1.2 Type: unspecified type (application/octet-stream)
> Encoding: base64
We are currently running DB2 v4 and have a large portion of our
daily activity coming from distributed users. We have been experiencing
this storage creep problem in subpool 229 for some time now but have
been thus far unable to indentify the cause. We receive an abend code
of S004e-00e20003, dumps have been sent to IBM but so far they have been
unable to identify the problem. Currently it has been our misfortune to
have to "STOP DDF" on a daily(midday) basis inorder to temporarily
relieve this storage problem. Obviously this is not a permanent
solution but until we find the true solution it is all we have. Any
help or hints that anyone can give from past or present experience would
be greatly appreciated.
Thanks for taking the time to respond. No, we have not IPLed but we have cycled
DB2 and that seems to clear it up.
thanks again,
Jerry
Sue E. Wild wrote:
------------------------------------------------------------------------
>
> Name: PIC00361.PCX
> PIC00361.PCX Type: Bitmap Image
(application/x-unknown-content-type-Paint.Picture)
> Encoding: base64
Dynamic SQL is necessary to make the cursor "ambigouous".
From the Glossary of the DB2 for MVS/ESA V4 Command Reference:
"ambiguous cursor. A database cursor that is not defined with either
the clauses FOR FETCH ONLY or FOR UPDATE OF, is not defined on a
read-only result table, is not the target of a WHERE CURRENT clause on
an SQL UPDATE or DELETE statement, and is in a plan or package that
contains SQL statements PREPARE or EXECUTE IMMEDIATE."
Without a PREPARE or EXECUTE IMMEDIATE (Dynamic SQL calls), the cursor
will not be ambiguous. DB2 will know based on other static calls whether
you expect to update/delete WHERE CURRENT OF cursor.
All this being said, I concede that all programmers should know the
intended use of a cursor, and as it says in DB2 for MVS/ESA V4
Application Programming and SQL Guide, in section 4.2.6.1.4:
"In all cases, it is a good programming technique to eliminate the
ambiguity by declaring the cursor with one of the clauses FOR FETCH
ONLY or FOR UPDATE OF."
Good to remove ambiguity in the developer's mind, if not DB2's...
Regards,
Jon Heinecke
Senior Technical Specialist
Compuware Corporation
Opinions expressed are my own, and do not reflect those
of my client or employer.
=================================================
thank
Willie
> Just a quick one for all you 'real world' people out there.
>
> At a recent roadshow here in the UK, I made what is about the ONLy
> bold
> statement I've ever made about DB2.
>
> I stated that I couldn't think of a single circumstance when a
> programmer
> wouldn't know whether to code FOR FETCH ONLY or FOR UPDATE OF when
> declaring a cursor - but of course I also said I was sure there'd be
> exceptions. As yet, none of the expected exceptions have come to mind.
>
> So......
>
> Can anyone suggest a GOOD reason for not coding one of the above
> clauses on
> cursor definitions, mainly for my own interests.
>
> Cheers
>
> Phil Grainger
> Product Consultant
> PLATINUM technology UK