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 » Add zero before BLOB message

Post new topic  Reply to topic
 Add zero before BLOB message « View previous topic :: View next topic » 
Author Message
CAONIMA
PostPosted: Wed Mar 11, 2015 12:45 pm    Post subject: Add zero before BLOB message Reply with quote

Acolyte

Joined: 03 Dec 2014
Posts: 65

Hi All,

I will change the CorrelId and the value needs to be the value of RootElement of the XML document (input message).

The data type of RootElement is CHAR.

So I need to CAST the RootElement to BLOB.

If it less than 24 bytes, I will add zeros before it.

The CorrelId is BLOB, so I CAST the RootElement as BLOB fist.

But I don't know how to add zero before it.

It said: Invalid or incompatible data types for '||' operator.

Here is my code:


Code:
DECLARE RootValueBlob BLOB CAST(Root_Element AS BLOB CCSID InputRoot.Properties.CodedCharSetId);
   
      
       DECLARE LEN INT;
   
      SET LEN = LENGTH(RootValueBlob);
      
      WHILE (LEN < 24)
         DO
         SET RootValueBlob=RIGHT('0'||RootValueBlob,24);
         SET LEN = LEN +1;
      END WHILE;


After '||', it cannot connect the BLOB data type.

So how should I do?

Thank you very much.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Mar 11, 2015 12:55 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Well your char is a hex representation of 24 bytes and needs 48 chars.
So why don't you use the char to append / prepend char '0' until the total is 48 chars and only then cast it to BLOB?

Your problem is because your are trying to concatenage a char with a blob.
You should be trying to concatenate a hex 00 with the blob or a char with the char.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Thu Mar 12, 2015 4:41 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

How about using the OVERLAY function?
http://www-01.ibm.com/support/knowledgecenter/SSKM8N_8.0.0/com.ibm.etools.mft.doc/ak05230_.htm
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
CAONIMA
PostPosted: Thu Mar 12, 2015 4:58 am    Post subject: Reply with quote

Acolyte

Joined: 03 Dec 2014
Posts: 65

fjb_saper wrote:
Well your char is a hex representation of 24 bytes and needs 48 chars.
So why don't you use the char to append / prepend char '0' until the total is 48 chars and only then cast it to BLOB?

Your problem is because your are trying to concatenage a char with a blob.
You should be trying to concatenate a hex 00 with the blob or a char with the char.


Thank you for you reply,

When I add char'0' until the total is 48 chars, and CAST it to BLOB.

The BLOB return the '0000' are '3030'

What is the problem?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Mar 12, 2015 5:00 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You mean something like

Code:
SET insertstr = replicate('0', 48 -length(id));
result = overlay(id placing  insertstr from 0 for 0);

_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
CAONIMA
PostPosted: Thu Mar 12, 2015 5:28 am    Post subject: Reply with quote

Acolyte

Joined: 03 Dec 2014
Posts: 65

fjb_saper wrote:
You mean something like

Code:
SET insertstr = replicate('0', 48 -length(id));
result = overlay(id placing  insertstr from 0 for 0);


Thank you for your reply, I think the problem solved
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Add zero before BLOB message
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.