| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| decsci.c | 2020-05-11 | 7.0 kB | |
| readme.txt | 2020-05-11 | 3.5 kB | |
| Totals: 2 Items | 10.4 kB | 0 | |
Subject: USING keyword
Newsgroups: comp.databases.informix
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
From: adel@q8petroleum.com.kw
Date: Sun, 17 Mar 96 14:40:17 GMT
Hi INFORMIX' ers
filed1 is decimal(10,6)
filed1 may be up to 6 decimal or 2 decimal
How would I prevent trailing zeroes from being printed
(i.e. filed1=148.33 will be printed using ###.###### format as 148.330000)
I must use ###.###### format because it may be up to 6 decimal..
any hints.....
thanks........................
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
From: cmm@trac3000.ueci.com (Colin McGrath)
Date: 21 Mar 1996 17:18:20 -0500
adel@q8petroleum.com.kw wrote:
>
> filed1 is decimal(10,6)
> filed1 may be up to 6 decimal or 2 decimal
>
> How would I prevent trailing zeroes from being printed
> (i.e. filed1=148.33 will be printed using ###.###### format as 148.330000)
> I must use ###.###### format because it may be up to 6 decimal..
>
Place the number in a character field and clean it up, as follows:
LET char_field1 = field1 using "##&.######"
FOR idx = 10 to 5 STEP -1
IF char_field1[idx] != "0" THEN
EXIT FOR
ELSE
LET char_field1[idx] = " "
END IF
END FOR
--
Colin McGrath <Standard disclaimers apply>
Internet: cmm@trac3000.ueci.com Voice: 215-422-4144 FAX: 215-422-1445
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
From: johnl@informix.com (Jonathan Leffler)
Date: 21 Mar 1996 17:48:19 -0500
Put simply, you can't do it with USING.
I attach some code which I am sure I have previously published on
the net, which is different from the USING code. It does not
actually have an option for suppressing trailing zeroes, but you
could easily provide one, somehow, if you are a C programmer. If
not, maybe some kind soul will do it for you, but I wouldn't hold
my breath waiting.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
>From: adel@q8petroleum.com.kw
>Date: Sun, 17 Mar 96 14:40:17 GMT
>X-Informix-List-Id: <news.22361>
>
>filed1 is decimal(10,6)
> filed1 may be up to 6 decimal or 2 decimal
>
>How would I prevent trailing zeroes from being printed
>(i.e. filed1=148.33 will be printed using ###.###### format as 148.330000)
>I must use ###.###### format because it may be up to 6 decimal..
From: brent@advgroup.co.nz (Brent Jackson)
Date: Sun, 24 Mar 1996 21:49:26 GMT
johnl@informix.com (Jonathan Leffler) wrote:
>Put simply, you can't do it with USING.
>>From: adel@q8petroleum.com.kw
>>Date: Sun, 17 Mar 96 14:40:17 GMT
>>X-Informix-List-Id: <news.22361>
>>
>>filed1 is decimal(10,6)
>> filed1 may be up to 6 decimal or 2 decimal
>>
>>How would I prevent trailing zeroes from being printed
>>(i.e. filed1=148.33 will be printed using ###.###### format as 148.330000)
>>I must use ###.###### format because it may be up to 6 decimal..
If you are using 4GL then I think you can do it with USING, but you require
an if statement and two USING clauses. Something like :
LET temp_value = filed1 * 100
IF (temp_value * 10000) = (filed1 * 1000000) THEN
PRINT filed1 USING "###.##"
ELSE
PRINT filed1 USING "###.######"
END IF
This is untested, but should give you the general idea.
Cheers,
Brent Jackson.
brent@hypercom.co.nz Phone : 64-9-3603593 Fax : 64-9-3602840
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++