How Can I Write A Large >32k Rawdata Object To A File

Yosef Gold

New Member
I have routine that writes all the fields in a record to an external file.
It loops through the fields, checks each field type and writes it to a file.

I use this line to export a Raw field (i.e. a field defined as a "raw" datatype in the database):
put unformatted quoter( string( phBuffer:buffer-field(i):buffer-value ) ).
It works fine when the field is less than 32K, but when the data is >32K then I get this error:
** Start or length of SUBSTRING/OVERLAY may not be larger than 32000. (656)
** Unable to evaluate expression for PUT statement. (564)
How can I export the entire field?
(I assume that I need to export the field in 32K chunks, but I'm not sure how to do that.)
Thanks.
 
Last edited:

Stefan

Well-Known Member
The vanilla dump / load uses a separate directory for lobs - I think it then uses COPY-LOB to copy the lob field with some key to the directory.

As an alternative you may be able to use write-xml / write-json - but their support for escaping invalid characters (which you probably have in your raw field) has had issues.
 

Cringer

ProgressTalk.com Moderator
Staff member
What are you trying to achieve? (Bigger picture)
You can use COPY-LOB to get the data into a LONGCHAR variable. You can't use PUT/EXPORT on those though as far as I know. You can also use COPY-LOB to get the data into a file on its own.
 

joey.jeremiah

ProgressTalk Moderator
Staff member
you could also use repeated put statements that export the blob in chunks that will allow you to keep everything in one file.
 
Top