Sorry...here the code goes :-)
The source is not pure C is Pro*C (but the pointers are the same :-) )
Code:
/* Global variables */
EXEC SQL BEGIN DECLARE SECTION;
retorno[199];
EXEC SQL END DECLARE SECTION;
char * consultaCuenta(char *buffer)
{
EXEC SQL WHENEVER SQLERROR DO return (sqlError(buffer));
EXEC SQL DECLARE CD CURSOR for
select lpad(num_doc,11,' ')| lpad(MONTO,11,' ')||lpad(NUM_CONSEJERA,12,' ')||estado
from AVON_CAJAVEC
where
num_doc = lpad(:pecnmro_servicio,10,'0');
EXEC SQL OPEN CD;
EXEC SQL WHENEVER NOT FOUND DO break;
for (;;)
{
EXEC SQL FETCH CD INTO :retorno;
sprintf(buffer,"%198.198s", retorno);
}
EXEC SQL CLOSE CD;
return (buffer);
}
the function where the results is received is too long to put here, but the important sentences are this:
char *buff_aux;
buff_aux = consultaCuenta(buffer);
thanks again