× 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.



On 12-Jul-2010 12:20, Darryl Freinkel wrote:
On 12-Jul-2010 09:03, Alan Shore wrote:

I'm wondering if day is defined as numeric and being zero
suppressed

I'm guessing but try the following

FLOAT( CHAR(
YEAR(DATE_FIELD)
|| MONTH(DATE_FIELD)
|| digit(DAY(DATE_FIELD))
) )


I tried this and it made it worse. I could not believe that. It
padded outthe field with trailing zeroes.


The result of the DAY scalar function is a large integer.
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/db2/rbafzscadayfunc.htm

The DIGITS() function applied to a large integer will cause that portion of the expression to be padded with leading zeroes for each value in the small set of possible integer values 1 to 31 for the DAY() scalar; i.e. the character string result of the integers cast to character, will be from '0000000001' to '0000000031'. The desired result is the two-character values from '01' to '31'.

Even after data typing\precision correction, the DIGITS scalar would need to be applied also to the MONTH(DATE_FIELD) expression, since that field will also represent integers less than ten.

An example of a two-digit numeric result cast to a two-character string: DIGITS(DECIMAL(DAY(DATE_FIELD), 2, 0))


For some reason, the system is rounding when it converts
character to number. Does anyone know why?


Perhaps share an example of the concern? However if the reference is to the "rounding" [actually, the loss in precision] for the IEEE float representation, I can only suggest reading about floating point for its inability to well-represent decimal. Use a decimal data type if accurate decimal representation is desirable.

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.