I am using DB2 v7 on AIX and using a ksh script to extract and load data. Currently, we are running the following code to get the sqlcode...

sqlcode=`db2 -ec +o << EOF

This gets us the sqlcode, but we are missing out on any other information contined in the sqlca as well as any record counts of rows inserted, deleted or rejected.

I know we can get the sqlca, but have not been able to find a good way to get the data out that we need for further processing.

Is there some variable set when the command completes with this information in there? I know that other scripts set a RETURNCD variable equal to $?, so is there something like this for the sqlcode and/or the other values in the sqlca?

I'm somewhat new to db2 like this, so any help is appreciated. Thanks.