Previous Topic: RIGHT-JUSTIFYNext Topic: SINE


SIGN-VALUE

Purpose

Returns a +1, 0, or -1, depending on whether the specified numeric value is positive, zero, or negative, respectively.

Syntax

►►─┬─ SIGN-VALue ─┬─ ( value ) ───────────────────────────────────────────────►◄
   └─ SIGV ───────┘

Parameters

value

Specifies the numeric value whose sign is determined.

Value can be:

Example

In the following example, the sign value function is used to move a zero to a transaction code field if an amount is negative, and a 1 to the field if the amount is zero or positive. On mapout, the transaction code field can be decoded to CR or DB:

Initial value:
    WK-AMT: -453.29
Statements:
    MOVE SIGN-VALUE(WK-AMT) + 1 TO TRANS-CODE.
    IF TRANS-CODE EQ 2
      THEN
        MOVE 1 TO TRANS-CODE.
Returned value from function: -1
Result of MOVE expression:     0