Please enable JavaScript to view this site.
From version 6.2.62 - Program to format a numeric value with a varying number of input decimals and output a value with a specific number of decimals. The result may be rounded and include comma delimiters if required. You may also change the decimal point character to cater for UK and European numbers.
Notes:
•If the 'Input value string' contains a minus sign (on the right) then this will be output - see Example 2.
•This program only caters for numeric values with a maximum of 10 characters before the decimal point and a maximum of 5 decimal places.
Parameter |
In |
Len |
Out |
Len |
PARM1 |
Input value string |
132 |
Output string |
132 |
PARM2 |
Output decimals (0-5) / Round (R) |
2 |
- |
|
PARM3 |
Thousand delimiter etc. |
1 |
- |
|
PARM4 |
Input Decimal point e.g. “.” or ”,” |
1 |
- |
|
PARM5 |
Output Decimal point e.g. “.” or ”,” |
1 |
- |
|
PARM6 |
Length of output string #1 |
3 |
- |
|
Note #1: It is extremely important that you specify the correct length for your returned value in PARM6 otherwise your output could be truncated. Also the length specified here will include a possible minus sign in order that all values are returned with the same length i.e. positive numbers will be one character shorter than negative ones. Valid entries are 2 - 132.
Example 1
Parameter |
Input |
Output |
PARM1 |
1234.679 |
1,234.68 |
PARM2 |
2R |
|
PARM3 |
, |
|
PARM4 |
||
PARM5 |
||
PARM6 |
Parameter |
Input |
Output |
PARM1 |
1234.679- |
1,234.67- |
PARM2 |
||
PARM3 |
, |
|
PARM4 |
||
PARM5 |
||
PARM6 |
9 |