We are using informix dynamic server 9.4 and client SDK 2.8.1. My program fetches the data from informix server using esql/c.

When I fetch the data from the informix, it fetches the correct data(varchar) for first record and for other record it fetches only 4 bytes.
The sample of my code is:

case SQLVCHAR :
case SQLCHAR :

EXEC SQL GET DESCRIPTOR escrs[Cur_thread->num] VALUE :i
:char_len = LENGTH;

c_char_len = char_len;
char_data = (char *) realloc (char_data, c_char_len + 1);

EXEC SQL GET DESCRIPTOR escrs[Cur_thread->num] VALUE :i
:indicate = INDICATOR,
:char_data = DATA;

EXEC SQL SET DESCRIPTOR escrs[Cur_thread->num] VALUE :i
DATA = '\0';

if (indicate == -1)
char_data[0] = '\0';
else
char_data[byleng(char_data, char_len)] = '\0';

c_char_len = strlen (char_data);

If we change the datatype of field from varchar to char. The same application works fine. Is it a problem with varchar datatype in informix dynamic server? Is there setting required in the informix server.

The same program is working fine on informix 9.2 as well as 9.3 and client SDK 2.8.1.
It is very critical problem, i need to resolve it ASAP.

Any suggestion will be appreciated.

Thanx in Advance!
Deepak