Rory,
Here is how you remove (or insert) the trailing zero'es
* Declare Internal Variables
d numField s 15s 7 inz(123446.5120000)
d result s 42 varying
d GetRidOfDec pr 42a varying
d thisNumField 30s 9 const
d thisDecNbr 2s 0 const
/free
result = getRidOfDec(numField:0);
dsply result;
*inlr = *on;
/end-free
p getRidOfDec b
d pi 42a varying
d thisNumField 30s 9 const
d ThisDecNbr 2s 0 const
d work s 100a
d result s 42a varying
/free
work = %editw(ThisNumField:' 0 . ');
if thisDecNbr = 0;
result = %triml(%subst(work:1:21));
else;
result = %triml(%subst(work:1:(22+thisDecNbr)));
endif;
return result;
/end-free
p e
Rory Hewitt <rory.hewitt@xxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
06-04-2010 19:33
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
To
"RPG programming on the IBM i / System i" <rpg400-l@xxxxxxxxxxxx>
cc
Subject
Re: BIFs requiring constants = frustrating
Henrik,
You're right - you can't specify decpos. However, you can use a regular
expression using the pattern keyword to force a number of decimal places,
can't you?.
In any event, however, this is a valid XML string element:
<value>$123.450000</value>
If the program that will process the XML document expects 6 decimal
places,
it could fail if only the 2 non-zero ones are sent, depending on the code
used.
Rory
On Tue, Apr 6, 2010 at 10:39 AM, <hr@xxxxxxxxxxxx> wrote:
Rory,
if you look in the W3C documentation there is no where I can find where
you can put
a currency suýmbol or a number of dec positions into a numeric field,
but
maybe
I am wrong
/henrik
As an Amazon Associate we earn from qualifying purchases.