Try OpenEdge Now
skip to main content
ABL Data Types Addenda
Using large objects in ABL : Copying large objects
 

Copying large objects

The COPY-LOB statement copies large object data from one BLOB or MEMPTR (or one CLOB or LONGCHAR) to another. It also handles copying data to or from the file system. The CONVERT phrase allows code page conversion of CLOB values and LONGCHAR values.
Here is the syntax for the COPY-LOB statement:

Syntax

COPY-LOB
  [ FROM ]{[ OBJECT ]source-lob| FILE source-filename }
     [ STARTING AT n][ FOR length ]
  TO {[ OBJECT ]target-lob[OVERLAY AT n[TRIM ]]|
     FILE target-filename[ APPEND ]}
  [ NO-CONVERT | CONVERT convert-phrase]
  [ NO-ERROR ].
You can copy the entire contents of the source to the target with COPY-LOB. You can also use the COPY-LOB statement to copy part of a file (for example, using STARTING AT or FOR) to the target. For more information about the COPY-LOB statement, see OpenEdge Development: ABL Reference
You can also use the ASSIGN statement to copy large object data between the database, temp-table fields, and memory. For example, the following ASSIGN and COPY-LOB statements (where m2 is a MEMPTR) are functionally equivalent:
ASSIGN employee.blob = m2.
COPY-LOB FROM m2 TO employee.blob.
You can assign large object data from one BLOB or MEMPTR to another, and from one CLOB or LONGCHAR to another. You cannot assign large object data between BLOB and CLOB values or MEMPTR and LONGCHAR values. However, you can accomplish this indirectly by using the COPY-LOB statement.
* Converting code pages for CLOB and LONGCHAR values