× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



There are several ways to convert from character to numeric.

With V5R2, use built-ins %Dec, %DecH, %Int, %IntH, %Uns, $UnsH, and %Float

Here are a few ideas for pre-V5R2 releases...


Check out the January 31, 2002 issue of Club Tech iSeries Programming Tips
newsletter in which I provide a sample service program that uses MI built-in
_CVTEFN to convert from character to numeric. Procedure CvtCharToNum uses a 30.9
field for the numeric that it returns to the caller so that it can handle the
largest possible packed decimal value. Once back in the calling program, you can
use Eval or Eval(H) and put the result in a field of your chosen precision and
decimal places.

You can find the service program at

http://www.iseriesnetwork.com/resources/artarchive/index.cfm?fuseaction=viewarticle&CO_ContentID=13735&channel=art&PageView=Search


You can also use embedded SQL and use the Cast function to convert from
character to numeric. Also, with embedded SQL, you can use SQL's built-in scalar
functions:

BigInt - convert to big integer

Decimal (or Dec) - convert to decimal

Double (or Double_Precision) - convert to floating point

Float - same as Double

Integer (or Int) - convert to integer


Gary Guthrie


Peter Vidal wrote:
>   
> Mike, I have tried to look for and search for some way to work this out.  My
> favorite place (besides MIDRANGE) is http://search400.techtarget.com/ but
> neither there...
> 
> I am curious...did you find a way to do it?


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.