ABS or ABSVAL scalar function

Returns the absolute value of the argument.

Read syntax diagramSkip visual syntax diagramABSABSVAL(expression)

The schema is SYSIBM.

The SYSFUN version of the ABS (or ABSVAL) function continues to be available.

expression
An expression that returns a value of any built-in numeric data type.

The result has the same data type and length attribute as the argument. The result can be null; if the argument is null, the result is the null value. If the argument is the maximum negative value for SMALLINT, INTEGER or BIGINT, the result is an overflow error.

Notes

Results involving DECFLOAT special values: For decimal floating-point values, the special values are treated as follows:
  • ABS(NaN) and ABS(-NaN) return NaN.
  • ABS(Infinity) and ABS(-Infinity) return Infinity.
  • ABS(sNaN) and ABS(-sNaN) return sNaN.

Example

   ABS(-51234)
returns an INTEGER with a value of 51234.