COPY-LOBFROM OBJECT source-lob FILE source-filenameSTARTING AT n FOR lengthTO OBJECT target-lob OVERLAY AT n TRIMFILE target-filename APPENDNO-CONVERT CONVERT convert-phraseNO-ERROR .source-lobOBJECTFILE source-filenameThe AVM raises the ERROR condition if source-filename resolves to the Unknown value (?) or the source file cannot be read. The filename can contain Unicode characters. See OpenEdge Development: Internationalizing Applications for more information about Unicode.FOR lengthtarget-lobOBJECTIf the specified target object does not yet exist, the AVM either creates a BLOB or a CLOB, or allocates memory for a MEMPTR or a LONGCHAR. If the specified target object already exists, the AVM deletes the object before the copy operation begins, by default. You can specify the OVERLAY AT n option to overlay some portion of an existing target object.
Note: OVERLAY AT n TRIMIf the target object does not yet exist, the AVM raises the ERROR condition. If the specified overlay position is less than 1, greater than the size of the object, or the Unknown value (?), the AVM raises the ERROR condition.FILE target-filename APPENDIf the target file does not exist, the AVM creates the file. If the target file exists, and you specify the APPEND option, the AVM opens the file and appends the object data to the end of a file. If the target file exists, but you do not specify the APPEND option, the AVM creates the target file anew (which overwrites the original file).If target-filename resolves to the Unknown value (?), or the target file cannot be created or written, the AVM raises the ERROR condition. The filename can contain Unicode characters.NO-CONVERT CONVERT convert-phraseThe NO-CONVERT option specifies that no conversions occur. However, if the target is a LONGCHAR or a CLOB, the AVM validates the character data based on the target object’s code page. For a CLOB, this is the code page of the CLOB. For a LONGCHAR, this is -cpinternal unless the LONGCHAR’s code page was set using the FIX-CODEPAGE statement. If the validation fails, the AVM raises the ERROR condition.The CONVERT option lets you specify how the AVM converts object data. Following is the syntax for convert-phrase:
SOURCE CODEPAGE codepageTARGET CODEPAGE codepage
Specify SOURCE CODEPAGE to indicate that a source object is in the specified code page. If you specify TARGET CODEPAGE, the AVM converts the target object to the specified code page.Table 19 lists the default character conversions the AVM performs when copying data between the source and target objects. References to CLOBCP and CLOBDB represent CLOB data in either the CLOB’s defined code page or the database's defined code page, respectively. References to the "fixed code page" represent the code page of a target LONGCHAR variable set using the FIX-CODEPAGE statement.
From -cpinternal to the database's defined code page From -cpinternal to the CLOB’s defined code page No conversion, the LONGCHAR is in -cpinternal or the fixed code page From the LONGCHAR’s code page to -cpinternal From the database's defined code page to -cpinternal From the database's defined code page to -cpinternal or the fixed code page From the CLOB’s defined code page to -cpinternal
Note: If either the source or the target object is a file, the target’s code page defaults to -cpstream.
The Byte Order Mark (BOM) or the encoding declaration is processed when a COPY-LOB operation reads from or writes to a FILE. For example, when a COPY-LOB statement copies data from a FILE (with a BOM) to a CLOB, the statement identifies and translates file content based on the BOM character but ignores the BOM character as part of the copy operation. And, when a COPY-LOB operation copies data from a CLOB to the beginning of a FILE, the statement prepends the BOM character, except when the BOM can be assumed; that is, the code page of the FILE target is UTF-8.
Also, if the COPY-LOB operation is written to a STARTING-AT location embedded within the FILE, the BOM character is not prepended to the written content. For more information on encoding declarations, see the OpenEdge Development: Working with XML guide.Suppresses ABL errors or error messages that would otherwise occur and diverts them to the ERROR-STATUS system handle. If an error occurs, the action of the statement is not done and execution continues with the next statement. If the statement fails, any persistent side-effects of the statement are backed out. If the statement includes an expression that contains other executable elements, like methods, the work performed by these elements may or may not be done, depending on the order the AVM resolves the expression elements and the occurrence of the error.
Check if the ERROR-STATUS:NUM-MESSAGES attribute is greater than zero to see if the AVM generated error messages. ABL handle methods used in a block without a CATCH end block treat errors as warnings and do not raise ERROR, do not set the ERROR-STATUS:ERROR attribute, but do add messages to the ERROR-STATUS system handle. Therefore, this test is the better test for code using handle methods without CATCH end blocks. ABL handle methods used in a block with a CATCH end block raise ERROR and add messages to the error object generated by the AVM. In this case, the AVM does not update the ERROR-STATUS system handle.
Use ERROR-STATUS:GET-MESSAGE( message-num ) to retrieve a particular message, where message-num is 1 for the first message.
You can also assign large object data from one BLOB or MEMPTR to another, and one CLOB or LONGCHAR to another, using the Assignment (=) statement or ASSIGN statement. You cannot use the Assignment (=) statement or ASSIGN statement to assign large object data between BLOBs or MEMPTRs and CLOBs or LONGCHARs.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |