Posted: Thu Aug 15, 2013 5:42 am Post subject: character to float conversion issue
Voyager
Joined: 01 Dec 2010 Posts: 76
hi ,
i am using below code to convert character to decimal for example if 10 is coming from channel in an xml message than it should be converted to 10.00 before sending it to target system.
DECLARE pattern CHARACTER '##0.00';
SET OutputRoot.XMLNSC.Response.Age = CAST(InputRoot.XMLNSC.Request.Age AS FLOAT FORMAT pattern) ;
The FLOAT data type holds a 64-bit, base 2, fraction and exponent approximation to a real number. This gives a range of values between +-1.7E–308 and +- 1.7E+308.
What makes you think FORMAT^PATTERN will apply to FLOAT type as output (ie. FORMAT^PATTERN only applies to CHARACTER, BIT, BLOB as output [re: character to float conversion issue])?
To any of the string data types (BIT, BLOB, or CHARACTER) from any of the numeric and date/time data types in the previous list.
dosttumhara1810 wrote:
why the outpuut is like this..i want 2300.00
You need to acquire the knowledge to do this. Your current knowledge level is insufficient. What's your plan to acquire this skill ? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
I agree with lancelotinc, you are casting as FLOAT, and then asking why you get a float in the output, can you not answer that yourself ?
Do you understand the different ESQL data types ? If you search for data types in the infocentre you will get some good info
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum