Skip to main content

developerWorks >  Information Management  >  Forums  >  DB2 for z/OS forum  >  developerWorks

datatype in C/C++ for DECFLOAT in DB2    Point your RSS reader here for a feed of the latest messages in this thread


     

 
 

My developerWorks
 Welcome, Guest
Sign in or register
Permlink Replies: 3 - Pages: 1 - Last Post: Nov 16, 2009 1:45 AM Last Post By: momi Threads: [ Previous | Next ]
kaliaanup

Posts: 1
Registered: Nov 10, 2009 02:17:29 AM
datatype in C/C++ for DECFLOAT in DB2
Posted: Nov 10, 2009 02:22:10 AM
Click to report abuse...   Click to reply to this thread Reply
Hi All

I need a urgent help !!!

Details of my OS are as follows
oS/390 version 03 Release 19.00 type Of hardware is 2097.

The C/C++ compiler i am using is z/OS V1.9 XL C/C++.

Kindly suggest me the datatype compatible with DECFLOAT in DB2 so that i can integrate my C++ application with DB2.

Is the datatype available/supported in my OS ??
momi

Posts: 87
Registered: Jan 07, 2007 10:49:29 AM
Re: datatype in C/C++ for DECFLOAT in DB2
Posted: Nov 11, 2009 02:21:43 AM   in response to: kaliaanup in response to: kaliaanup's post
Click to report abuse...   Click to reply to this thread Reply
basically, all data type mappings can be found in the Application Programming & SQL Guide

http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.apsg/db2z_apsg.htm

and your question
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.db29.doc.apsg/db2z_equivalentcdatatypes.htm

you should use datatype - _Decimal32 or _Decimal64 or _Decimal128

but, bad news:
To use the decimal floating-point host data type, you must do the following:
Use z/OS 1.10 or above (z/OS V1R10 XL C/C++ ).
Compile with the C/C++ compiler option, DFP.
Specify the SQL compiler option to enable the DB2 coprocessor.
Specify C/C++ compiler option, ARCH(7). It is required by the DFP compiler option if the DFP type is used in the source.
Specify 'DEFINE(__STDC_WANT_DEC_FP__)' compiler option because DFP is not officially part of the C/C++ Language Standard.
ShamimD

Posts: 2
Registered: Nov 11, 2009 03:47:12 PM
Re: datatype in C/C++ for DECFLOAT in DB2
Posted: Nov 11, 2009 04:03:09 PM   in response to: momi in response to: momi's post
Click to report abuse...   Click to reply to this thread Reply
Hi Anup,
Thanks for raising this question in forum.

Hi Momi,

Thanks for information given below!

I am also looking to migrate my db2 columns from 'double' to 'DECFLOAT' to avoid loss in data precision due to rounding errors.

Please find below my system specifications -

Operating system: zOS - z/OS 10.00 01
C++ compiler - XL series C++ compiler v1.10 on Z/OS
Transaction Manager : CICS
Database - DB2 REL 915

What equivalent datatype should I use in my business layer (written in C++) and DM layer written in Pro*C (host variable representation)? Can you please suggest a way to migrate my double datatypes to DECFLOAT with these system and language preferences?

Will really appreciate your help on this!
momi

Posts: 87
Registered: Jan 07, 2007 10:49:29 AM
Re: datatype in C/C++ for DECFLOAT in DB2
Posted: Nov 16, 2009 01:45:14 AM   in response to: ShamimD in response to: ShamimD's post
Click to report abuse...   Click to reply to this thread Reply
Hi

I never performed such a task myself since I don't use c++ and C,
did you try to find an answer in the links I posted here?
 Tags
Help

Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular type of content or application that you're viewing.

My tags shows your tags for this particular type of content or application that you're viewing.

 

MoreLess 


Point your RSS reader here for a feed of the latest messages in all forums