COBOL Manual for TNS and TNS/R Programs
Intrinsic Functions
HP COBOL Manual for TNS and TNS/R Programs—522555-006
14-52
REM Function
REM Function
REM, a numeric function, returns the remainder that results from dividing its first
argument by its second argument.
dividend
is a numeric argument.
divisor
is a nonzero numeric argument.
If ARRAY1 has only two elements, the first of which satisfies the requirements for
dividend and the second of which satisfies the requirements of divisor, then
FUNCTION REM (ARRAY1(ALL))
returns the remainder that results from dividing ARRAY1(1) by ARRAY1(2).
The returned value is the remainder of dividend divided by divisor, which is
defined:
dividend - (divisor * FUNCTION INTEGER-PART (dividend / divisor))
Example 14-35. REM Function
Code:
DISPLAY FUNCTION REM (11 5)
DISPLAY FUNCTION REM (-11 5)
DISPLAY FUNCTION REM (11 -5)
DISPLAY FUNCTION REM (-11 -5)
Output:
01
-01
01
-01
( )
REMFUNCTION dividend divisor
VST458.vsd