Problem with NAMED PIPES in external Program Interface

Posted by jvillasc on 09-May-2008 20:08

Hi, I´am working with a named PIPE on UNIX, trying to exchange binary data from a JAVA program to a ABL program and reverse , that's work with TEXT data , but fail with BINARY data.

For import the binary data I try to use a MEMPTR filed, but loose some data in the process.

This is a simple code.

define var mptr_reg as memptr.

define char_reg as char format "X(250)".

SET-SIZE(mptr_reg)=278.

REPEAT: /* Wait for the sender information process */

INPUT FROM inpipe BINARY NO-CONVERT.

REPEAT : /* read record by record. */

IMPORT mptr_reg.

/* the first 24 bytes have numeric an null values */

char_reg = GET-STRING(mptr_reg,25,250).

/* now I try to process the string information */

display substring(char_reg,1 60).

END .

All Replies

Posted by Admin on 10-May-2008 16:11

I think you will have to use:

IMPORT mptr_reg UNFORMATTED.

to read the 0-characters. Or use "READKEY" to read a binary file character by character (slow).

I assume the string will be truncated during the DISPLAY-statement, since you copy a RAW-string variable which has 0-characters. A CHAR-variable with value "abc[0]def", where [0] represents ASCII 0, will DISPLAY "abc"...

This thread is closed