473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Convert Char string with Sign to Decimal in DB2

I need to convert a character string using DB2 SQL into a decimal (11,2). This character string has a sign also. I tried using Decimal verb and it gives ++++++++ sign after converting.
Appreciate help.

Example
input:
SUBSTR SUBSTR
110006 0000000000{
110011 0000000000{
110016 0000000000{
110020 0000000893H
110071 0000000000{

Query:
select substr(varlenfld, 18, 13),
decimal(substr(varlenfld,229,11),11,2) from
library/filename f

output:
SUBSTR DECIMAL
110006 +++++++++++++++
110011 +++++++++++++++
110016 +++++++++++++++
110020 +++++++++++++++
110071 +++++++++++++++
Aug 25 '15 #1
1 5555
I think it is possible to code but it is tedious to convert the last character into a hexa using a function in DB2. Can anyone help me come up with a hexa table for all the last characters. BTW, is there any better way in DB2 SQL?
Aug 26 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: BA | last post by:
Hello, I have a string with a price in: "$14.95" I need to get it into a decimal. So I regex 'd the string and dumped the $. Debug mon shows a clean string "14.95" Then I do a...
3
by: Gospill | last post by:
Hi Guru, If I have string like "0D76" for example, it is actually a 0x0D76 in hex format. How can I convert the hex string 0D76 into decimal value ? So that I will get decimal value 3446 ...
4
by: STom | last post by:
How do you convert a string in C# to decimal? STom
3
by: sushant.bhatia | last post by:
Whats the difference between :- 1. Convert.ToDecimal(stringNumber) 2. Decimal.Parse(stringNumber) 3. decimal.Parse(stringNumber) Thanks. Sushant Bhatia
5
by: Bob | last post by:
Hi, It must be easy but I can't see how to this is done. I mean there will be a plethora of built in methods / properties DEVOTED to this fundmental need just waiting to be invoked right? It...
6
by: Mark Chimes | last post by:
Hi All, I need to search thru some strings and discard them if they canot be converted to a decimal or interger value. What is the best way to do this? cheers, Mark Chimes
1
by: AnandhaMurugan | last post by:
I got a numberformatException when i convert from string to decimal how to resolve it java.lang.NumberFormatException at java.math.BigDecimal.<init>(BigDecimal.java:455) at...
0
by: marwanharb | last post by:
hello, I've designed a simple interface in C# to communicate with my FPGA (send data and receive a value), the problem is my FPGA algorithm output (ex: 3) is shown in some strange symbol (which...
8
by: dsd50 | last post by:
hard to explain... i have a character field with a 'floating' decimal point and need to order it to get the next incremental decimal place but can't get the convert/cast to work after 1 place to the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.