Display only 2 frac_digits in decimal(12).
Posted in 2003
Topics: Installation, Setup & Upgrades, SQL Development & Query Writing, Stored Procedures & SPL, Versions, Editions & End-of-Life
Hi all.
My customer using ISQL 4.3.
Now Customer will upgrade 4.3 to 7.32.
Customer has a problem using ISQL 7.32.UC1 as bellow.
create table test1(
a decimal(12),
b decimal(12.7)
);a.per
database stores_demo
screen size 24 by 80
{
a [f000 ]
b [f001 ]
}
end
tables
test1
attributes
f000 = test1.a;
f001 = test1.b;
Compile a.per.
Insert field a as 1234.5678.
DISPLAY fileld a as 1234.57.
Only 2 frac digits.
I searched comp.databases.informix, I found DBFLTMASK.
However I setted DBFLTMASK=4, no effect.
Still appears 2 digit(1234.57).
How can I do display 4 digits instead of 2 digits.
ENV:
Redhat 7.3
IDS 9.30.UC3
ISQL 7.32.UC1
Thanks in advance.
--
Tsutomu Ogiwara from Tokyo Japan.
ICQ#:168106592
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
sending to informix-list
Tsutomu Ogiwara wrote:
> My customer using ISQL 4.3.
> Now Customer will upgrade 4.3 to 7.32.
>
> Customer has a problem using ISQL 7.32.UC1 as bellow.
>
> create table test1(
> a decimal(12),
> b decimal(12.7)
> );> a.per
> database stores_demo
> screen size 24 by 80
> {
> a [f000 ]
> b [f001 ]
> }
> end
> tables
> test1
> attributes
> f000 = test1.a;
> f001 = test1.b;
>
> Compile a.per.
>
> Insert field a as 1234.5678.
> DISPLAY fileld a as 1234.57.
>
> Only 2 frac digits.
>
> I searched comp.databases.informix, I found DBFLTMASK.
> However I setted DBFLTMASK=4, no effect.
> Still appears 2 digit(1234.57).
>
> How can I do display 4 digits instead of 2 digits.
>
> ENV:
> Redhat 7.3
> IDS 9.30.UC3
> ISQL 7.32.UC1
Since field a is defined simply as a decimal(12) without the scale
parameter, I believe the data is being treated as a floating decimal - and
it is rounding the displayed value. If my memory on this is correct, a
DECIMAL defined without a scale parameter will print with two decimal places
unless you specify another format. Can you add a FORMAT attribute to field
a in the screen form to force the display?
For example:
f000=test1.a, format="####.####";
Again, if I remember this correctly, you'll get a warning if the format
string is shorter than the field width, but it is just a warning. Of
course, one possible problem with this suggestion is that you'll always get
four decimal places, regardless of the number that was entered.
--
June Hunt