> Is there a possibility to concert a string, which is in a column
> defined as 'FOR BIT DATA', in a normal string, so that i can use the
> normal string functions?
How should the conversion be done, given that FOR BIT DATA values store
binary data (which might include the string-termination character '\0' =
0x00)?

Signature
Knut Stolze
DB2 Information Integration Development
IBM Germany
tilmann - 28 Nov 2005 10:03 GMT
In my case, the data is encoded in ebcdic without '\0' in the relevant
portion of the data. I've read that this conversion migth be possible
in V8.
tilmann - 28 Nov 2005 10:04 GMT
In my case, the data is encoded in ebcdic without '\0' in the relevant
portion of the data. I've read that this conversion migth be possible
in V8.
Serge Rielau - 28 Nov 2005 11:04 GMT
> In my case, the data is encoded in ebcdic without '\0' in the relevant
> portion of the data. I've read that this conversion migth be possible
> in V8.
The easiest I can think of is to create a function which simply passes
the value through and spits it out as regular VARCHAR.
I think you are correct. In DB2 V8 for zOS the cast woudl look like:
CAST(<expr> AS VARCHAR(..) FOR SBCS DATA) (or DBCS) if I remember correctly.
DB2 V8.1 for LUW supports the same, btw.
Cheers
Serge

Signature
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
kangaroo - 29 Nov 2005 12:40 GMT
I've successfully cast FOR BIT DATA to CHAR in 8.1 just as
CHAR(COLUMN_NAME). This way, one could use it in SELECT statements
(although you still would have to take care of binary values in the
code that does a fetch).
The only area were doing this made practical sense, though, was in
conjunction with db2export (to pull any kind of column out into a flat
file).