|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
not understanding way asbitstream is working |
« View previous topic :: View next topic » |
Author |
Message
|
klabran |
Posted: Thu Mar 18, 2004 3:51 pm Post subject: not understanding way asbitstream is working |
|
|
 Master
Joined: 19 Feb 2004 Posts: 259 Location: Flagstaff AZ
|
IF I do below...
DECLARE INMSG CHAR;
SET INMSG = substring(asbitstream(OutputRoot.XML,,437) FROM 1 FOR 8000);
insert into Database.tblCitationInAudit (sdata)
values (INMSG);
I get a byte string....
If I do below...
insert into Database.tblCitationInAudit (sdata)
values ( substring(asbitstream(OutputRoot.XML,,437) FROM 1 FOR 8000));
I get the string data which is what I want.
Why is the first code snippet not returning the string data?
Kevin |
|
Back to top |
|
 |
mgk |
Posted: Thu Mar 18, 2004 4:13 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
This has nothing to do with ASBITSTREAM, it is always returning a BLOB.
This happens because assignment of a BLOB to an ESQL CHAR variable involved an implicit cast of the BLOB to the CHAR before asignment takes place. This results in X' ... ' around the string as no CCSID can be supplied to the CAST operation. In the second case you are assigning a BLOB to a VARCHAR (I assume) DB Column which means we give the raw BLOB to the DB without an assignment to an ESQL CHAR type (no implicit CAST takes place), so we never add the X' ... ' to the string.
To verify this, if you wrap a CAST with a CCSID clause around your first substring I think the results should then be the same. However the second will be more efficient as less steps are involved.
Cheers, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
klabran |
Posted: Thu Mar 18, 2004 5:28 pm Post subject: |
|
|
 Master
Joined: 19 Feb 2004 Posts: 259 Location: Flagstaff AZ
|
Thanks for the pointer. It works great now!
Kevin |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|