COPY-LOB Raw to File - Forum - OpenEdge Development - Progress Community

COPY-LOB Raw to File

This question is not answered

Is there any way to copy a RAW to a file and back again?  I'm working on an encryption project and need to save the hashed data, then retrieve it and decrypt the data into plaintext.

Thanks in advance for any help or advice.


All Replies
  • Put the RAW  data into a MEMPTR variable; COPY-LOB that wherever.
    def var r1 as raw.
    define variable mdata as memptr no-undo.
    put-string(r1, 1)  = 'abcde'.
    mdata = r1.
    copy-lob mdata to file session:temp-dir + 'raw.out'.
    set-size(mdata) = 0.
    And you can do the reverse on read. The RAW variable is automatically cleaned up, but you’ll need to manually SET-SIZE() on the MEMPTR to prevent memory leaks.