Question How to redeem field recorded?

Cecil

19+ years progress programming and still learning.

Cecil

19+ years progress programming and still learning.
If I can do a FIND on the table and fetch the field, for example:

FIND FIRST tb_documento_xml NO-LOCK NO-ERROR.

The field name is: tb_documento_xml.arq_xml

he is of type BLOB.

Try this. It might not compile the first time, may need to fix the errors.
Code:
USING net.progress.encode.gzip.Zlib.

DEFINE VARIABLE gzipFile   AS CHARACTER   NO-UNDO.
DEFINE VARIABLE xmlFile   AS CHARACTER   NO-UNDO.
DEFINE VARIABLE mpGZIPData AS MEMPTR      NO-UNDO.

ASSIGN
    xmlFile = SUBSTITUTE('&1DebugGzip.xml',
                          Session:Temp-dir)
    gzipFile = xmlFile + '.gz'

FIND FIRST tb_documento_xml
    NO-LOCK NO-ERROR.

PROCESS-BLOB:
IF AVAILABLE tb_documento_xml  THEN
DO:
  
    SET-SIZE(mpGZIPData) = 0.
  
    /** gzip format. Byte order: Little-endian. Offset Length Contents 0 2 bytes magic header  **/
    SET-BYTE-ORDER( mpGZIPData ) = LITTLE-ENDIAN.

    COPY-LOB FROM tb_documento_xml.arq_xml TO OBJECT mpGZIPData .

    IF GET-LONG(mpGZIPData,1) EQ 0x1f AND
       GET-LONG(mpGZIPData,2) EQ 0x8b THEN
        Message 'Confirmed. GZIP format'.
    ELSE
    DO:
        Message SUBSTITUTE('Failed GZIP format magic file format. &1 &2',
                           GET-LONG(mpGZIPData,1),
                           GET-LONG(mpGZIPData,2)
                           ).

        SET-SIZE(mpGZIPData) = 0.

        LEAVE PROCESS-BLOB.    
    END.
  
    /** Copy the memptr data to disk..**/
    COPY-LOB FROM OBJECT mpGZIPData TO FILE gzipFile.

    /** Uncompress the GZIP FILE FORMAT DATA..**/
    Zlib:getInstance():uncompressFile(gzipFile, chXMLFile , true).

    FILE-INFO:FILE-NAME = chXMLFile.

    MESSAGE SUBSTITUTE('Can you see this XML File? &1',
                       QUOTER(FILE-INFO:FULL-PATHNAME)).

    SET-SIZE(mpGZIPData) = 0.

END.
 
Last edited:

Rob Fitzpatrick

ProgressTalk.com Sponsor
The code now compiles, however at run time I get an error:
Code:
Could not load DLL procedure zlib1.dll. (3258)
There was no zlib1.dll packaged with the code from SourceForge.

I found a reference to it in zlib-prototype.p. Following the URL in the code (www.zlib.net) I downloaded version 1.2.8 and modified the ZLIB_LIB scoped-define to point to the fully-qualified path to the DLL. I also tried to register the DLL (I assume it's 32-bit) and that didn't work either.
 

Cecil

19+ years progress programming and still learning.
The code now compiles, however at run time I get an error:
Code:
Could not load DLL procedure zlib1.dll. (3258)
There was no zlib1.dll packaged with the code from SourceForge.

I found a reference to it in zlib-prototype.p. Following the URL in the code (www.zlib.net) I downloaded version 1.2.8 and modified the ZLIB_LIB scoped-define to point to the fully-qualified path to the DLL. I also tried to register the DLL (I assume it's 32-bit) and that didn't work either.

I just put the zlib1.dll file in my C:\Windows\SysWOW64 folder. I don't think you need to register it.

I'm on Windows 7 64bit OS.
screenshot126-png.1269
 

Attachments

  • ScreenShot126.png
    ScreenShot126.png
    34.7 KB · Views: 25

Cecil

19+ years progress programming and still learning.
That did the trick. It now gives me the XML document. Well, the first 3000 bytes of it, anyway. But I assume that's just an alert-box limitation.

Yup, limitation of the message box. So it does work. Thanks for testing.
Great, now I just need to figure why it's not working correctly for Anderson and returning only the first 25 Characters of the xml.
 
Top