Was this helpful?
compare Routine--Compare Two Data Elements
This routine compares values of two user-defined data types. If the II_DT_NOSORT attribute is provided in the dtd_attributes field, then the compare routine is not necessary.
The input arguments are II_DATA_VALUE pointers to the two data elements being compared. The data elements must be of the same type. The final argument, result, must be set to be a negative number, 0, or a positive, non-zero number depending on whether the first argument is less than, equal to, or greater than the second argument. That is,
if arg1 < arg2, result is negative
else if arg1 == arg2 result equals 0
else result is non-zero, positive
The address of this routine must be placed in the dtd_compare_addr field of the IIADD_DT_DFN structure.
Inputs
The inputs for this function are:
scb
Pointer to Session Control Block
op1
First operand. Pointer to a II_DATA_VALUE structures which contains the values to be compared.
op2
Second operand. Pointer to a II_DATA_VALUE structures which contains the values to be compared.
result
Pointer to integer to contain the result of the operation
Outputs
The outputs for this function are:
*result
Filled with the result of the operations. This routine is set *result as follows:
< 0 if op1 < op2
> 0 if op1 > op2
= 0 if op1 is equal to op2
Returns
II_STATUS
Last modified date: 04/03/2024