Expected output for conversion procedures

Except in the case of certain errors, your conversion procedure should replace the string in FPVDVALE with the converted string.

Begin program-specific programming interface information.

When converting MIXED data, your procedure must ensure that the result is well-formed. In any conversion, if you change the length of the string, you must set the length control field in FPVDVALE to the proper value. Over-writing storage beyond the maximum length of the FPVDVALE causes an abend.

Your procedure must also set a return code in field EXPLRC1 of the exit parameter list.

The following is a list of the codes for the converted string in FPVDVALE:

Table 1. Codes for the converted string in FPVDVALE
Code Meaning
0 Successful conversion
4 Conversion with substitution

For the following remaining codes, Db2 does not use the converted string:

Table 2. Remaining codes for the FPVDVALE
Code Meaning
8 Length exception
12 Invalid code point
16 Form exception
20 Any other error
24 Invalid CCSID

Exception conditions: Return a length exception (code 8) when the converted string is longer than the maximum length allowed.

For an invalid code point (code 12), place the 1- or 2-byte code point in field EXPLRC2 of the exit parameter list.

Return a form exception (code 16) for EBCDIC MIXED data when the source string does not conform to the rules for MIXED data.

Any other uses of codes 8 and 16, or of EXPLRC2, are optional.

Error conditions: On return, Db2 considers any of the following conditions as a conversion error:
  • EXPLRC1 is greater than 16.
  • EXPLRC1 is 8, 12, or 16 and the operation that required the conversion is not an assignment of a value to a host variable with an indicator variable.
  • FPVDTYPE or FPVDVLEN has been changed.
  • The length control field of FPVDVALE is greater than the original value of FPVDVLEN or is negative.

In the case of a conversion error, Db2 sets the SQLERRMC field of the SQLCA to HEX(EXPLRC1) CONCAT X'FF' CONCAT HEX(EXPLRC2).

The following diagram shows how the parameter list points to other information.

Figure 1. Pointers at entry to a conversion procedure
Begin figure description. Pointers at entry to a conversion procedure. End figure description.
End program-specific programming interface information.