SQL/MP Programming Manual for COBOL

Character Processing Rules (CPRL) Procedures
HP NonStop SQL/MP Programming Manual for COBOL529758-003
11-7
CPRL_COMPARE_
result pic S9(4) output
indicates the result of the comparison:
For error codes other than 0 (zero), result is meaningless.
cprladdr pic S9(9) input
is a pointer to the SQL collation or collation object.
CPRL_COMPARE_
The CPRL_COMPARE_ procedure compares two strings according to an SQL
collation or collation object. Both strings are assumed to be in original (not encoded)
form. For strings of unequal length, CPRL_COMPARE_ pads the shorter string with
blanks.
Use CPRL_COMPARE_ for isolated compares. Only the necessary part of each string
is encoded to perform the compare. However, if the same data is compared repeatedly,
use the CPRL_ENCODE_ and CPRL_COMPARE1ENCODED_ procedures (or
CPRL_ENCODE_ with binary compares).
The CPRL_COMPARE_ procedure returns these error codes:
string1 pic X(string1length) input
is an array containing the first string to be compared.
string1length pic S9(4) input
is the length in bytes of string1.
-1 The first operand is less than the second
0 The operands collate equally
1 The first operand is greater than the second
ENTER TAL "CPRL_COMPARE_" USING
string1,
string1length,
string2,
string2length,
result,
cprladdr
GIVING errorcode.
Code Description
0 The operation was successful.
–2 The SQL collation or collation object is invalid.
–4 The version of the SQL collation or collation object is not supported.