Numeric or character expression

When the first parameter is a numeric or character expression, the result has precision digits and decimal places decimal positions. The precision and decimal places must be numeric literals, named constants that represent numeric literals, or built-in functions with a numeric value known at compile-time.

Note:
%LEN and %DECPOS cannot be used directly for the second and third parameters of %DEC or %DECH, even if the values of %LEN and %DECPOS are constant. See Figure 227 for an example using the length and decimal positions of a variable to control %DEC and %DECH.

Parameters precision and decimal places may be omitted if the type of expression is neither float nor character. If these parameters are omitted, the precision and decimal places are taken from the attributes of the numeric expression.

If the parameter is a character expression, the following rules apply:

See %DECHfor examples using %DEC.



[ Top of Page | Previous Page | Next Page | Contents | Index ]