473,407 Members | 2,312 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,407 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 5558
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.