When using COPY-LOB to copy data from a database CLOB field to a file, the data is corrupted. For example if the data represents an XML file, then a few characters are missing from the beginning. Instead of:
the file begins:
The problem can be reproduced with code similar to:
DEFINE VARIABLE lcLob AS LONGCHAR NO-UNDO.
COPY-LOB file "C:\Results.xml" to lcLob.
COPY-LOB lcLob to file "C:\ResultsAfterCopyToLongChar.xml".
COPY-LOB lcLob to XMLRecord.valueclob. /* vlaueclob is an iso8859-1 CLOB field */
COPY-LOB contextvalue.valueclob to file "C:\ResultsAfterCopyToCLOB.xml".