You can unload LOB data in one of two ways.
About this task
LOB columns can be unloaded with either of the following methods:
- The
LOB column can be unloaded to the output records. The LOB column value can be placed in the OUTPUT
record with or without any other unloading column values. The output record can be in delimited or
non-delimited format. For a non-delimited format, the LOB column is handled like a variable
character with a 2-byte length preceding the LOB value. For a delimited format there are no length
bytes present. If the total output record length is more than 32 KB, unload the record in spanned
record format by specifying the SPANNED YES option.
- The LOB column can be unloaded to a separate file whether the LOB column length is less than 32K
or not.
Procedure
To unload LOB data, use one of the following methods:
-
To unload LOB data directly to output record:
Specify LOB as the output field type. If the output is a non-delimited format, a 2-byte length
will precede the value of the LOB. For delimited output, no length field is present. LOB is the only
acceptable field type when unloading the LOB data directly to the output record. No data type
conversion applies and you cannot specify FROMCOPY.
-
To unload LOB data to a separate file:
- Create an UNLOAD utility control statement. Specify BLOBF, CLOBF or DBCLOBF to indicate that the
output column contains a filename which the LOB value is to be unloaded. You cannot specify
FROMCOPY.
- Use the template control statement to create the LOB output file and filename. If data sets are
not created and the DSN type is not specified on the template, UNLOAD will use PDS as the data set
type. PDS has a limit of single volume. The output file uses multiple volumes, so you must specify
HFS as the DSN type.
If you unload data to a
separate file, and the LOB column from which you unload is empty, the data set that is specified by
UNLDDN contains one of the following items:
- A blank file name if the source column is specified as CHAR CLOBF, CHAR BLOBF, or CHAR
DBCLOBF
- A file name with length 0 if the source column is specified as VARCHAR CLOBF, VARCHAR BLOBF, or
VARCHAR DBCLOBF
The UNLOAD utility does not create a data set or file for the empty LOB.