Thursday, February 14, 2008

The Scoop on -804 SQLCODEs

Ever wonder why your test programs are getting a sqlcode -804?


The Book Manager definition for -804 says that the "call parameter list or the SQLDA is invalid." However, SQLDA is used for programs that have dynamic SQL, but you still get -804 for programs that have only static SQLs? Why is this?


Well, a -804 sqlcode for programs with static SQL is analogous to a S0C7 situation. In addition to regular working storage variables getting corrupt with invalid data, the SQLDA also gets corrupt. This manifests as an SQL -804 when you encounter the next available SQL statement thereby leading you into a wild goose chase thinking it is a DB2 problem.


So, the next time you get a -804, look closely at the working storage variables and any arrays that you may have. The arrays may be overflowing and creeping its way into the SQLDA which is added just before the linkage by the system. You may use the compiler option SSRANGE to detect array overflows in the test system. Do not use the SSRANGE compile option for production compiles since this adds system overhead (the default compile option is NOSSRANGE).
If you want additional information, or would like to see specific topics to be covered, please contact me via email at pkganapathi@yahoo.com.

4 comments:

Bharadwaja said...

Thanks very much for this useful tip!!

Bharadwaja said...

Thanks very much for the useful post!!

Devabrat Borah said...

Great update!! it helped us resolve a big production issue! there was an array overflow...

-devabrat@gmail.com

PKG said...

Thank you all. Glad to hear that the article helped you.

Devabrat:
Glad to hear it helped in fixing a production issue. It is always good and inspiring to hear such comments.