SQL/MP Programming Manual for COBOL

Character Processing Rules (CPRL) Procedures
HP NonStop SQL/MP Programming Manual for COBOL529758-003
11-9
CPRL_DECODE_
CPRL_DECODE_
The CPRL_DECODE_ procedure decodes a string that has been encoded by the
CPRL_ENCODE_ procedure. If the same (or equivalent) SQL collation is used for both
CPRL_ENCODE_ and CPRL_DECODE_, the decoded string will be equal to the
original string with respect to that SQL collation.
Because encoding is not generally a one-to-one function, the decoded string might not
be identical to the original string. For example, an SQL collation that is case-insensitive
might produce a decoded string with different case letters than the original string. The
string ABCDE might encode to a value, which is aBcDe when decoded.
The CPRL_DECODE_ procedure returns these error codes:
encodedstring pic X(encodedstringlength) input
is an array containing the data to be decoded.
encodedstringlength pic S9(4) input
is the number of bytes in encodedstring to be decoded.
decodedstring pic X(decodedstringmaxlength) output
is an array in which CPRL_DECODE_ returns the decoded string. Overlapping
encodedstring and decodedstring causes unpredictable results.
decodedstringmaxlength pic S9(4) input
specifies the maximum length of decodedstring.
ENTER TAL "CPRL_DECODE_" USING
encodedstring,
encodedstringlength,
decodedstring,
decodedstringmaxlength,
decodedstringlength,
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.
–20 The user-specified buffer is not large enough to receive the returned string.