When you need to display a number, either integer or real, that is held in a variable, you will often have to format the output so that it is aligned correctly in a field or column of numbers.
The &NUMEDIT built-in function lets you reformat any number held in a variable by specifying three parameters:
Examples: &NUMEDIT Usage
In these examples the character ^ represents a blank.
&A = (2 * 88) results in ( &A = 176 ) &B = &NUMEDIT (0,2,0) results in &A( &B = 176.00 ) &A = (2 * 88) results in ( &A = 176 ) &B = &NUMEDIT (5,2,0) results in &A( &B = ^^176.00 ) &A = (4.8 + 6.998) results in ( &A = +.117980000000000E+02 ) &B = &NUMEDIT (8,5,) results in &A( &B = ^^^^^^11.79800 ) &A = (2.3 ** 2) results in ( &A = +.529000000000000E+01 ) &B = &NUMEDIT (4,4,E) results in &A( &B = ^^^5.2900E+00 )
For more information, see the Network Control Language Reference Guide.
Note: The width of the mantissa will always be at least the number of characters in the mantissa, even if the mantissa parameter is less than the actual number of characters. The first example shows this, where the mantissa parameter is 0 but the mantissa length is three characters (176).
The E format of &NUMEDIT always returns one decimal digit to the left of the decimal point.
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |