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

Dumping large objects

When you use EXPORT to dump large object (LOB) data from a database, a uniquely named file with a .blb extension is generated for each BLOB or CLOB. By default, the .blb file is written to the same location as the file in the OUTPUT TO statement. You can use the optional LOB-DIR dir-name phrase on the OUTPUT TO statement, where dir-name evaluates to the name of the directory to write the .blb file to.
EXPORT stores the file names in the exported file (typically a .d file), in the position where the ordinary field data would be placed if the field contained non-LOB data. If the LOB field has the Unknown value (?), the AVM writes a question mark (?) in that place; if it is a zero-length LOB, the AVM creates a file as it does for any BLOB field, but the file has a zero length.
In the following example, the contents of the BLOB field is not written to the blob.txt file. Instead, the contents of the BLOB field is written to a new file with a .blb extension (for example, blob-field_123456.blb) and only the name of the file containing the BLOB data is written to blob.txt:
OUTPUT TO blob.txt.
EXPORT table.blob-field.
OUTPUT CLOSE.
Note that if the OUTPUT TO statement in this example included the LOB-DIRdir-name option, then the blob-field_123456.blb file would be created in the LOB-DIR directory. However, the AVM does not create the LOB-DIR directory if it does not already exist.
In the following example, the names of the files that contain the BLOB data are written to the customer.d file in the C:\DumpedData\ directory and the files are written to C:\DumpedData\custblob:
OUTPUT TO C:\DumpedData\customer.d LOB-DIR "custblob".

FOR EACH customer:
EXPORT customer.
END.

OUTPUT CLOSE.
Here is an excerpt from the contents of the customer.d file:
"lift line skiing", 1, "photo_123456.blb", 617-9666673, "boston"
"off the wall", 2, "photo_234567.blb", 781-5555554, "new york"
"flying fat", 3, ? , 303-9992222, "washington"
Note that the third customer had no data in the photo field and therefore is the Unknown value (?). Note also that the generated filename is always unique. If the LOB-DIR phrase is left off of the OUTPUT TO statement, the BLOB files are created in the C:\DumpedData directory.
For CLOB values, the code page of the CLOB is part of the filename generated by the EXPORT statement. The file name consists of the field or variable name, followed by the code page name surrounded by exclamation marks (!), followed by the unique name and the .blb extension. For example:
Fclob!UTF-8!12345_6.blb