Joined: 20 Oct 2006 Posts: 6962 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.