Consultor Eletrônico



Kbase P160376: 4GL/ABL: Error(12008) and (11316) using COPY-LOB statement.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/03/2010
Status: Unverified

SYMPTOM(s):

4GL/ABL: Error(12008) and (11316) using COPY-LOB statement.

Invalid character code found in data for codepage UTF-8 (12008)

Could not obtain LONGCHAR. (11316)

The COPY-LOB statement is used to move data from a BLOB field to a LONGCHAR variable.

The errors are generated executing code similar to the following code:
DEFINE VARIABLE Longchar-Var AS LONGCHAR NO-UNDO.
DEFINE TEMP-TABLE ttTable NO-UNDO
FIELD Blob-Field AS BLOB.
CREATE ttTable.
COPY-LOB FILE "test.xlsx" TO OBJECT ttTable.Blob-Field.
/* The following statement generates the errors */
COPY-LOB OBJECT ttTable.Blob-Field TO OBJECT Longchar-Var.

FACT(s) (Environment):

Windows
All Supported Operating Systems
OpenEdge 10.1x
OpenEdge 10.2x

CAUSE:

The COPY-LOB statement can be used to move the contents of a BLOB field into a LONGCHAR variable ONLY when the BLOB field contents are pure CHARACTER NON BINARY data. The contents of the EXCEL file are BINARY and not pure CHARACTER data. Hence, the errors.

FIX:

Use a MEMPTR variable as the target of the COPY-LOB statement when the source field contains non CHARACTER binary data. For example, the following version of the above code snippet runs error free:
DEFINE VARIABLE Memptr-Var AS MEMPTR NO-UNDO.
DEFINE TEMP-TABLE ttTable NO-UNDO
FIELD Blob-Field AS BLOB.
CREATE ttTable.
COPY-LOB FILE "test.xlsx" TO OBJECT ttTable.Blob-Field.
/* The following statement generates the errors */
COPY-LOB OBJECT ttTable.Blob-Field TO OBJECT Memptr-Var.