Errors occur when writing to DB2 with SAS/ACCESS® Interface to DB2 when *_max_bytes is set in the LIBNAME statement


When the LIBNAME statement contains *_max_bytes with DB2 UTF-8 encoding and SAS Unicode, errors occur when you insert into DB2. Here are two scenarios in which this issue occurs.

Scenario 1:

Read from a DB2 table that contains a VARGRAPHIC and create a SAS data set. Then create a DB2 table from the SAS data set, and the following error occurs:

ERROR: During insert: [IBM][CLI Driver] CLI0125E Function sequence error. SQLSTATE=HY010

Scenario 2:

Create a DB2 table from sashelp.class (with *_max_bytes set), and the following error occurs:

ERROR: During insert:[IBM] [CLI Driver] CLI0109E String data right truncation. SQLSTATE=22001

To work around this issue, create one LIBNAME statement for reading from DB2 and one LIBNAME statement to write to DB2.