Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

REM - Remainder

The REM function returns a numeric value that is the remainder of argument-1 divided by argument-2.
The type of this function is numeric.

Format


FUNCTION REM (argument-1 argument-2)


Arguments

  1. argument-1 and argument-2 must be class "numeric".

  2. The value of argument-2 must not be zero.

  3. The value v of the quotient argument-1/argument-2 must lie in the range - 1031 < v < 1031

Returned values

  1. The returned value is the remainder of argument-1 / argument-2. It is defined as the expression:

    argument-1 - (argument-2 * FUNCTION INTEGER-PART (argument-1 / argument-2))
  2. The error default value is - 9’999’999’999’999’999’999’999’999’999’999.


See also:
        MOD

Example 9-39

...
DATA DIVISION.
WORKING-STORAGE SECTION.
01  R PIC 999.
PROCEDURE DIVISION.
P1 SECTION.
MAIN.
    COMPUTE R = FUNCTION REM (928 14).
    DISPLAY R UPON T.
    STOP RUN.

Result:               004