View previous topic :: View next topic
|
Author |
Message |
moumi das Warnings : 1 New User
Joined: 21 Dec 2009 Posts: 10 Location: Kolkata
|
|
|
|
Hi,
I would like to which one of the following is good cobol program writing practice:
Should we handle return code while declaring a cursor OR
it is enough if we handle RC while opening the cursor? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What error codes have you seen that were caused by a DECLARE CURSOR? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
if you look at the compiler listing, there is no code generated for the declare cursor, so no need to check the sqlcode. actually the declare cursor (in addition to other things) is part of the DSNSQL SECTION which is executed as soon as your program is invoked (the first time).
So, if you declare a cursor and then check the sqlcode that has not been initialized, you are using either garbage from the module load or the sqlcode of a previous db2 call.
so, NO. no sqlcode check after a declare cursor - a mistake that many make. |
|
Back to top |
|
|
moumi das Warnings : 1 New User
Joined: 21 Dec 2009 Posts: 10 Location: Kolkata
|
|
|
|
Thanks |
|
Back to top |
|
|
|