ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » BLOB to BLOB question

Post new topic  Reply to topic
 BLOB to BLOB question « View previous topic :: View next topic » 
Author Message
jrannis
PostPosted: Tue Nov 13, 2001 3:38 pm    Post subject: Reply with quote

Novice

Joined: 04 Nov 2001
Posts: 10
Location: Waterloo Ontario

I have defined an InputNode as BLOB, and I want to take the blob and add some string data to it and send it out as BLOB.

How do you do this? I cannot seem to concatinate a string onto the incoming BLOB because BLOB is not a string an thus cannot be concatinated to. If I cast my BLOB as character, all I get is the hex representation as a string.

i.e. myString = 'hello '
InputRoot.BLOB = X'1234567890'

SET OutputRoot.BLOB=mystring || CAST(InputRoot.BLOB AS CHAR)

RESULT: 'hello X'1234567890''

This is certainly not the result I was looking for and I cannot put this on the output node either, because it is not of format BLOB. How do I convert myString to BLOB? The CAST(myString as BLOB) does not work because myString must look like X'123456'.

In short, if the hex representation of 'hello ' is X'68656c6c6f20' and InputRoot.BLOB = X'1234567890' How do I get X'68656c6c6f201234567890' without major string matipulation?

Any ideas would be much appreciated.



Back to top
View user's profile Send private message
mapa
PostPosted: Wed Nov 14, 2001 2:25 am    Post subject: Reply with quote

Master

Joined: 09 Aug 2001
Posts: 257
Location: Malmö, Sweden

Hi,

Unfortunately you can't.
You have to represent mystring as hex
BUT, reading the announcement letter for Websphere MQ Integrator 2.1 I am pretty sure I saw that the ESQL has been enchanced in some aspects and one of them seem to be that you will be able to do the cast that you want.
It says Binary casting is now supported at least.

Best regards Magnus Palmér
Back to top
View user's profile Send private message Visit poster's website
satish
PostPosted: Wed Nov 28, 2001 10:24 pm    Post subject: Reply with quote

Newbie

Joined: 26 Nov 2001
Posts: 9

Hi,
you have to convert input data to string first by using the mapping technique explained below and then do the concatination.
--Variables Declaration
DECLARE LoopCount INTEGER;
DECLARE LastCount INTEGER;
DECLARE MsgLen INTEGER;
DECLARE Pos1 INTEGER;
DECLARE Pos2 INTEGER;
DECLARE Message CHARACTER;
DECLARE ApplicationID CHARACTER;
DECLARE ErrMsgID CHARACTER;
DECLARE MessageText CHARACTER;
DECLARE ErrorDescription CHARACTER;
DECLARE DataStreamID CHARACTER;
DECLARE FieldID CHARACTER;
DECLARE CUSIP CHARACTER;
DECLARE InvVehld CHARACTER;
DECLARE InputBody_BIN CHAR;
DECLARE InputBody_CHAR CHAR;
DECLARE HiByteTable CHAR;
DECLARE LoByteTable CHAR;
DECLARE CharTable CHAR;
DECLARE HiByte CHAR;
DECLARE LoByte CHAR;
DECLARE TheChar CHAR;
DECLARE AppHiByte CHAR;
DECLARE AppLoByte CHAR;
DECLARE I1 INTEGER;
DECLARE I2 INTEGER;
DECLARE I4 INTEGER;


--To convert Binary to Ascii
SET LoByteTable = '0123456789ABCDEF0123456789A123456789ABCDEF0123456789AE10345E6A89FBDDBDCBDCA2B7CEFCEFF';
SET CharTable = ' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+-={}|[]:"; <>?,./ ';
SET HiByteTable = '244444444444444455555555555666666666666666777777777777242225222252237775553232333222F';

SET InputBody_BIN = BITSTREAM("InputRoot"."BLOB"."BLOB");

SET I1 = 2;
SET I2 = 1;
SET InputBody_CHAR= '';

WHILE I2 <= length(InputBody_BIN) DO
SET HiByte = UPPER(SUBSTRING(InputBody_BIN FROM I2 FOR 1));
SET LoByte = UPPER(SUBSTRING(InputBody_BIN FROM I1 FOR 1));
SET TheChar = ' ';

IF HiByte = '3' THEN
SET TheChar = LoByte;
ELSE
SET I4 = 0;
WHILE I4 < LENGTH(CharTable) DO
SET AppHiByte = SUBSTRING(HiByteTable FROM I4 FOR 1);
SET AppLoByte = SUBSTRING(LoByteTable FROM I4 FOR 1);
IF HiByte = AppHiByte AND LoByte = AppLoByte THEN
SET TheChar = SUBSTRING(CharTable FROM I4 FOR 1);
SET I4 = LENGTH(CharTable);
END IF;
SET I4 = I4 + 1;
END WHILE;
END IF;

SET InputBody_CHAR = InputBody_CHAR || TheChar;
SET I1 = I1 + 2;
SET I2 = I2 + 2;
END WHILE;

Hope this helps..



_________________
IBM Certified MQSeries Specialist
IBM Certified MQSI Specialist
Back to top
View user's profile Send private message
hutulas
PostPosted: Thu Nov 29, 2001 12:39 pm    Post subject: Reply with quote

Newbie

Joined: 18 Nov 2001
Posts: 5

The above works but it is extremely slow. Also, the statement "IF HiByte = '3' THEN " causes a problem because it converts stuff from 3A-3F to a character rather than the symbols that they should be. If you comment out this IF statement it seems to work (but slowly if you have a large blob)
Back to top
View user's profile Send private message
hutulas
PostPosted: Thu Nov 29, 2001 12:40 pm    Post subject: Reply with quote

Newbie

Joined: 18 Nov 2001
Posts: 5

The above works but it is extremely slow. Also, the statement "IF HiByte = '3' THEN " causes a problem because it converts stuff from 3A-3F to a character rather than the symbols that they should be. If you comment out this IF statement it seems to work (but slowly if you have a large blob)
Back to top
View user's profile Send private message
thfox
PostPosted: Fri Nov 30, 2001 6:47 am    Post subject: Reply with quote

Newbie

Joined: 04 Nov 2001
Posts: 1

We've had some some success in bringing in a variable length string from the message using the following technique.

Outline:
1. Read as a BLOB
2. Append a null X'00'
3. Change context to MRM message set
4. Message defines input as null delimited string


We put this in a subflow to be used by several projects.

The ESQL for appending the BLOB is:

-- Append a hex '00' (null) to the end of a BLOB message
SET OutputRoot."BLOB"."BLOB" = InputRoot."BLOB"."BLOB" || X'00';

It seems to perform very well.

Hope this helps.
Back to top
View user's profile Send private message
satish
PostPosted: Fri Dec 07, 2001 3:01 am    Post subject: Reply with quote

Newbie

Joined: 26 Nov 2001
Posts: 9

Hi hutulas,
can you please eloborate on the anwswer you have mentioned. we are using it in one of our flows, it is working fine for our test cases, I am definetly intrested to know if I am missing anything.
I agree with you that it is very slow,Let me know if you have any other solution to increase the speed.

thanks in advance,
satish

_________________
IBM Certified MQSeries Specialist
IBM Certified MQSI Specialist

[ This Message was edited by: satish on 2001-12-07 03:04 ]
Back to top
View user's profile Send private message
hutulas
PostPosted: Fri Dec 07, 2001 5:06 am    Post subject: Reply with quote

Newbie

Joined: 18 Nov 2001
Posts: 5

Satish,
A problem occurs when HEX Characters 3A-3F are used which are ":;<=>?". The logic states that if the high byte is 3 just use the low byte as the ASCII value.
So...If you send through a document with a < in it this will resolve to a 'C'.
Let me know if I didn't make myself clear!
Back to top
View user's profile Send private message
Miriam Kaestner
PostPosted: Fri Dec 07, 2001 5:09 am    Post subject: Reply with quote

Centurion

Joined: 26 Jun 2001
Posts: 103
Location: IBM IT Education Services, Germany

You can use the BITSTREAM function to convert a part of the message (InputRoot, InputBody, InputRoot.MQMD and so on - no individual fields!!) to hex representation.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » BLOB to BLOB question
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.