Author |
Message
|
huebi |
Posted: Mon Aug 20, 2001 4:17 am Post subject: |
|
|
Novice
Joined: 01 Jul 2001 Posts: 16
|
Hi,
is there really no built-in converting from characters to BLOBs?
DECLARE x CHARACTER;
SET x = 'XYZ';
CAST(x AS BLOB) does not a converting.
Of course i can write a little bit of code, but i cant reuse this code
as a function mpdule and i need this several times in a Compute node.
|
|
Back to top |
|
 |
kolban |
Posted: Tue Aug 21, 2001 5:35 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2001 Posts: 1072 Location: Fort Worth, TX, USA
|
You may wish to look at the TREEASIS parser. The question I am most interested in is why do you wish to convert a string to a blob? |
|
Back to top |
|
 |
Tibor |
Posted: Tue Aug 21, 2001 5:50 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
>why do you wish to convert a string to a blob?
Because there are BLOB values, like MQMD.CorrelID.
Dummy solution for casting:
1. insert into a database table
2. read back with a select
Ugly, but works...
|
|
Back to top |
|
 |
huebi |
Posted: Wed Aug 22, 2001 10:27 pm Post subject: |
|
|
Novice
Joined: 01 Jul 2001 Posts: 16
|
Quote: |
On 2001-08-21 06:35, kolban wrote:
You may wish to look at the TREEASIS parser. The question I am most interested in is why do you wish to convert a string to a blob?
|
I have to write some Data in front of a Msg varying in Size. Something like a header. Of course i can say
DECLARE desc BLOB;
SET desc '41643b45....
SET inblob = desc || inblob
but i would be more readable and more failsave if i can declare desc as character and fill in a readable description.
Evrytime this not-understable limitation of fixed-length messages in MRM hits me.
|
|
Back to top |
|
 |
wolstek |
Posted: Thu Aug 30, 2001 5:57 am Post subject: |
|
|
Acolyte
Joined: 25 Jun 2001 Posts: 52 Location: Bristol, UK
|
I likewise have wished that you could cast a string into a BLOB for various reasons. e.g. when manipulating BLOB strings for xmit to IMS for example.
The way I have got around it is to use the BITSTREAM function though this obviously has limitations of working on a complete message tree and that you may have to do the BITSTREAM in a succeeding node.
Asuming input to Compute node is MRM, the following will cast the entire MRM string into BLOB format.
DECLARE C BLOB;
SET C = BITSTREAM(InputRoot.MRM);
|
|
Back to top |
|
 |
kolban |
Posted: Thu Aug 30, 2001 7:14 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2001 Posts: 1072 Location: Fort Worth, TX, USA
|
When using TREEASIS, you can append string to blob ...
SET OutputRoot.TREEASIS.data1 = 'This is a string';
SET OutputRoot.TREEASIS.data2 = 0x'123456';
When put to the queue, you will have a message that contains
"This is a string <0x12><0x34><0x56>" |
|
Back to top |
|
 |
huebi |
Posted: Fri Aug 31, 2001 12:19 am Post subject: |
|
|
Novice
Joined: 01 Jul 2001 Posts: 16
|
Quote: |
SET OutputRoot.TREEASIS.data1 = 'This is a string';
SET OutputRoot.TREEASIS.data2 = 0x'123456';
When put to the queue, you will have a message that contains
"This is a string <0x12><0x34><0x56>"
|
Thats not human readable, and making errors ist guaranteed. |
|
Back to top |
|
 |
|