I have very little experience with DB2, but am writing a simple C program, with
embedded SQL, that has among other things
[The original code compiles fine, any typing errors below are my fault in posting]
EXEC SQL BEGIN DECLARE SECTION;
double F;
/*...*/
EXEC SQL END DECLARE SECTION;
...
Then do a DECLARE a cursor, OPEN it and FETCH a "REAL" column
into this host variable F.
Printing it out (printf( ".. %7.2f .. "); does not yield the expected values (2.5, or such, which is returned by a straight DB2 query from the commandline)
but either 0.00, -0.00 or some some massive string of digits (100 or so).
It looks like I am reading the data types wrong, but can't see where.
The DB2 server instance is running on the same machine where the client
program is compiled and run. I have tested this on two separate machines,
with similar results.
I've written a similar program, that looks the same to me, for all intents and
puroses, but that one works. I would appreciate any pointers to the solution
from more experienced DB2 users.
embedded SQL, that has among other things
[The original code compiles fine, any typing errors below are my fault in posting]
EXEC SQL BEGIN DECLARE SECTION;
double F;
/*...*/
EXEC SQL END DECLARE SECTION;
...
Then do a DECLARE a cursor, OPEN it and FETCH a "REAL" column
into this host variable F.
Printing it out (printf( ".. %7.2f .. "); does not yield the expected values (2.5, or such, which is returned by a straight DB2 query from the commandline)
but either 0.00, -0.00 or some some massive string of digits (100 or so).
It looks like I am reading the data types wrong, but can't see where.
The DB2 server instance is running on the same machine where the client
program is compiled and run. I have tested this on two separate machines,
with similar results.
I've written a similar program, that looks the same to me, for all intents and
puroses, but that one works. I would appreciate any pointers to the solution
from more experienced DB2 users.
Comment