Subject Re: [ib-support] identify a char
Author Jan Henrik Sylvester
""Nick Upson"" <uebridger@...> schrieb im Newsbeitrag
news:F244DAeys8FSA4AleLI0001d084@......
> I tried having an external table that also contained the 'bad'
> character and doing ' .. where not in (select bad ..)
> but that didn't work either
>
> >can I express a char(1) field value in hex?
> >
> >charfld = '\x00';
> >
> >I'm currently importing a load of data via external tables, using a
dbproc
> >to perform the actual conversion to the internal table(s) for each.
> >
> >Unfortunately the data file has a load of null characters at
> >the end. I want to do something like "select ... from externaltable where
> >field <> ch" but I can't work out how to express the value for ch.
> >
> >cat -v shows the character as ^@, my editor (pfe) shows it \x00

Have you tried using the UDF functions. Maybe you can use any of these:

0=ASCII_VAL(YOUR_COLUMN)
0=STRLEN(YOUR_COLUMN)
ASCII_CHAR(0)=YOUR_COLUMN

Beware of the wrong declaration of ASCII_CHAR in the IB docs.
(After that, I'd try RTRIM, SUBSTR, LTRIM, or combinations...)

HTH,
Jan Henrik Sylvester <me@...>

------------------------------------------------------------
DECLARE EXTERNAL FUNCTION ASCII_CHAR
INTEGER
RETURNS CSTRING(1) FREE_IT
ENTRY_POINT 'IB_UDF_ascii_char' MODULE_NAME 'ib_udf';

DECLARE EXTERNAL FUNCTION ASCII_VAL
CHAR(1)
RETURNS INTEGER BY VALUE
ENTRY_POINT 'IB_UDF_ascii_val' MODULE_NAME 'ib_udf';

DECLARE EXTERNAL FUNCTION STRLEN
CSTRING(32767)
RETURNS INTEGER BY VALUE
ENTRY_POINT 'IB_UDF_strlen' MODULE_NAME 'ib_udf';
------------------------------------------------------------