Rational Developer for System z
COBOL for Windows, Version 7.5, Language Reference


MOD

The MOD function returns an integer value that is argument-1 modulo argument-2.

The function type is integer.

The function result is an integer with as many digits as the shorter of argument-1 and argument-2.

Format
Read syntax diagramSkip visual syntax diagram>>-FUNCTION MOD--(--argument-1--argument-2--)------------------><
 
argument-1
Must be an integer.
argument-2
Must be an integer. Must not be zero.

The returned value is argument-1 modulo argument-2. The returned value is defined as:

argument-1 - (argument-2 * FUNCTION INTEGER (argument-1 / argument-2))

The following are expected results for some values of argument-1 and argument-2.

argument-1 argument-2 Returned value
11 5 1
-11 5 4
11 -5 -4
-11 -5 -1

Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)