Important We are integrating BMC AMI LOBMaster technology into the BMC AMI Reorg product and discontinuing BMC AMI LOBMaster as a separate product. For the latest integrated documentation, see BMC AMI Reorg for Db2 13.1.

MOD


(BMC.DB2.SPE2207)

The MOD Db2 SQL function divides the first argument by the second argument and returns the remainder. 

The MOD function supports only the following integer data types: 

SMALLINT

Binary integer with a precision of 15 bits. The valid range is from -32768 to +32767.

INTEGER

Binary integer with a precision of 31 bits. The valid range is from -2147483648 to +2147483647.

BIGINT

Binary integer with a precision of 63 bits. The valid range of big integers is from -9223372036854775808 to +9223372036854775807.

image2022-6-6_15-24-46.png

integerExpression returns a value that is a built-in integer data type (SMALLINT, INTEGER, or BIGINT).

Important

If any argument is null, the result is a null value.

You can use the MOD function in the following contexts with the listed products:

Context

Product

Index on expression

BMC AMI Reorg,  BMC AMI Load

WHERE clause

BMC AMI Reorg,  BMC AMI Load, BMC AMI Unload

Select list

BMC AMI Unload

LOAD VALUE SQL expressions 

BMC AMI Load

Arguments and Result

The data type of the result depends on the arguments according to the following guidelines:

  • If any argument is a BIGINT, the result is a nullable BIGINT. Otherwise, the result is a nullable INTEGER. 
  • The sign of the result is the same as the sign of the first argument. For example, if the first argument is negative, the result is negative
  • The second argument cannot have a value of 0 in the IOE (Index On expression) otherwise the utility JOB will fail with an error message.
  • While using the MOD function in LOAD value SQL expression if second argument is 0, then that row is rejected and discarded in BMC AMI Load.
  • If any of the arguments is not an integer, an error message is issued followed by the Utility command rejection.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*