SQL/MX 3.2.1 Programming Manual for C and COBOL (H06.26+, J06.15+)

Host Variables in C/C++ Programs
HP NonStop SQL/MX Release 3.2.1 Programming Manual for C and COBOL663854-005
3-27
Numeric Data
int SQL_BignumMul( BignumExt result, Uint16 resultLen,
BignumExt operand1, Uint16 operand1Len, BignumExt operand2,
UInt16 operand2Len)
The result is the product of operand1 and operand2.
If the operation is successful, this function returns 0. Otherwise, the function returns an
EXE_NUMERIC_OVERFLOW error.
SQL_BignumDiv
The SQL_BignumDiv function divides two BigNum values.
int SQL_BignumDiv( BignumExt result, UInt16 resultLen,
BignumExt operand1, UInt16 operand1Len, BignumExt operand2,
UInt16 operand2Len)
The result is the quotient of dividing operand1 by operand2.
The function returns:
0, if the division does not produce a remainder
1, if the division produces a remainder
EXE_DIVISION_BY_ZERO, if the operand2 value is zero.
EXE_NUMERIC_OVERFLOW error, if the division is not successful
SQL_BignumSign
The SQL_BignumSign function retrieves the sign of a BigNum value:
void SQL_BignumSign( Int16 * sign, BignumExt value, UInt16
valueLen )
The sign operand is set to 0 for positive BigNum values and -1 for negative BigNum
values.
Considerations for BigNum Arithmetic function
When you declare a BigNum host variable (NUMERIC (20, 3)), SQL/MX translates the
value to a short data type array in the C language. The short data type array has no
scale. The scale is implicit and must be handled in the application. For example, you
want to assign the value 1234 to the BigNum host variable using the BigNum
assignment functions. If you place the value 1234 directly, the decimal point is implicit.
Therefore, the actual value interpreted by the SQL/MX is 1.273. To place the value
1273 into the table, the value 1237000 must be assigned to the BigNum assignment
functions.