Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / November 2005

Tip: Looking for answers? Try searching our database.

Conversion of 'FOR BIT DATA' string to normal string in DB2 V7

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tilmann - 28 Nov 2005 09:42 GMT
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?

I'm using DB2 V7.2 on z/OS.

Thanx
Knut Stolze - 28 Nov 2005 09:52 GMT
> 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).
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.