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-24
Numeric Data
Initializing NUMERIC Data Types
Initialize NUMERIC data types in your application with an assignment statement. No
strcpy or CAST is needed. NUMERIC types are binary types. In this example, the
value 10 is moved to host_var, which is declared as a long.
EXEC SQL BEGIN DECLARE SECTION;
NUMERIC(7,0) host_var;
EXEC SQL END DECLARE SECTION;
host_var=10;
Initializing BigNum Data Types
You can initialize the BigNum data type with a constant int64 value, either from another
BigNum value or from an ASCII string that represents a BigNum value.
BigNum Data Type
A BigNum value is an array of int16 elements. The last element that contains the sign
is the most significant bit. The BigNum data type is defined as follows:
typedef Int16* BignumExt
BigNum Functions
You can use the following BigNum functions to perform basic operations on a BigNum
Host variable:
Assignment Functions
Comparison Functions
Conversion Functions
Arithmetic Functions
Assignment Functions
You can assign an Int64 value to a BigNum host variable or a BigNum value to an
Int64 variable using the assignment functions.
SQL_BigNumAssign Function
The SQL_BigNumAssign function assigns an Int64 value to a BigNum host variable:
int SQL_BignumAssignI64( BignumExt result, UInt16 resultLen,
Int64 valOp)
The SQL_BigNumAssign function sets the value of result from valOp.
If the assignment is successful, this function returns 0. Otherwise, the function returns
an EXE_NUMERIC_OVERFLOW error, if the resultLen is not large enough to hold
the valOp data.