Previous Topic: Trigonometric FunctionsNext Topic: ARC COSINE


ABSOLUTE-VALUE

Purpose

Returns the absolute value of a numeric value.

Syntax

►►─┬─ ABSOLUTE-VALUE ─┬─ ( value ) ───────────────────────────────────────────►◄
   └─ ABS-val ────────┘

Parameters

value

Specifies the numeric value whose absolute value is calculated.

Value can be:

Example

In the following example, the absolute value function is used to specify the absolute value of a calculated length in a substring function:

Initial values:
    EMP-NAME: 'JOE SMITH'
    WK-LENGTH: -3
Statement:
    MOVE SUB(EMP-NAME,1,ABS(WK-LENGTH)) TO WK-FNAME.
Returned value from ABS function: 3
Returned string from SUB function: 'JOE'