And here is a little more advanced of the same ;-)
regards
Henrik
* Declare Internal Variables
d numField s 15s 7 inz(-123446.5120000)
d result s 42 varying
d GetRidOfDec pr 42a varying
d thisCurSymbl 3a const varying
d thisNumField 30s 9 const
d thisDecNbr 2s 0 const
/free
result = getRidOfDec('$':numField:6);
dsply result;
*inlr = *on;
/end-free
p getRidOfDec b
d pi 42a varying
d thisCurSymbl 3a const varying
d thisNumField 30s 9 const
d ThisDecNbr 2s 0 const
d work s 100a
d numField s 30s 9
d result s 42a varying
/free
result = ThisCurSymbl;
if thisNumField >= 0;
numField = thisNumField;
else;
result = result + '-';
numField = -thisNumField;
endif;
work = %editw(numField:' 0 . ');
if thisDecNbr = 0;
result = result + %triml(%subst(work:1:21));
else;
result = 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.