cs_cmp

Description

Compares two data values.

Syntax

CS_RETCODE cs_cmp(context, datatype, var1, var2,
                  result)
 CS_CONTEXT       *context;
 CS_INT           datatype;
 CS_VOID          *var1;
 CS_VOID          *var2;
 CS_INT           *result;

Parameters

context

A pointer to a CS_CONTEXT structure.

datatype

One of following symbolic values, to indicate the datatype of var1 and var2:

Value of datatype

Indicates this datatype

CS_DATE_TYPE

CS_DATE

CS_TIME_TYPE

CS_TIME

CS_DATETIME_TYPE

CS_DATETIME

CS_DATETIME4_TYPE

CS_DATETIME4

CS_DECIMAL_TYPE

CS_DECIMAL

CS_MONEY_TYPE

CS_MONEY

CS_MONEY4_TYPE

CS_MONEY4

CS_NUMERIC_TYPE

CS_NUMERIC

CS_BIGDATETIME_TYPE

CS_BIGDATETIME

CS_BIGTIME_TYPE

CS_BIGTIME

var1

A pointer to the first operand for the comparison.

var2

A pointer to the second operand for the comparison.

result

On successful return, *result is set to indicate the result of the comparison:

Value of *result

Indicates

-1

var1 is less than var2.

0

var1 is equal to var2.

1

var1 is greater than var2.

Returns

cs_cmp can return the following values:

Returns

Indicates

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed. If cs_cmp returns CS_FAIL, *result is undefined.

The most common reason for a cs_cmp failure is an invalid parameter.

cs_cmp generates a CS-Library error message for most failure conditions. See “Error handling”.

Usage

See also

cs_calc, cs_convert, cs_strcmp