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 » Padding in ESQL

Post new topic  Reply to topic
 Padding in ESQL « View previous topic :: View next topic » 
Author Message
SOLOHERO
PostPosted: Tue Jan 01, 2008 8:51 pm    Post subject: Padding in ESQL Reply with quote

Centurion

Joined: 01 Feb 2007
Posts: 107

Hi,

i want to pad a field with 0s in esql could you please tell me how can i do that.

My request messages comes with a 13 char field (corrId) , i am setting this value to MQMD.correId but as the CorreId takes only 48 bytes i have to pad the rest bytes with 0, could you please help me how can i do this.

Thanks..
_________________
Thanks
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Tue Jan 01, 2008 11:00 pm    Post subject: Reply with quote

Grand High Poobah

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

Have you tried setting a shared low value 0x000000 to ablob?
Then assuming that the correl is not null
SET myblob = myblob || cblob;
And take the leftmost 24 bytes?

But seriously this looks like a design flaw. The correlid should be an anonymous identifier. Check the flags on the MQMD and move the corresponding msgid or correlid of the incoming msg to the response...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Wed Jan 02, 2008 5:16 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

There is an OVERLAY function.

CorrelID does not need to be padded, though.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
SOLOHERO
PostPosted: Thu Jan 03, 2008 8:54 pm    Post subject: Reply with quote

Centurion

Joined: 01 Feb 2007
Posts: 107

Thanks for your solutions, i got this thing fixed by concatinnating.

CREATE FUNCTION Paddings(IN CorrId CHARACTER ,IN SeqId CHARACTER) RETURNS BLOB
BEGIN

DECLARE Len_CorrId INTEGER;
DECLARE Len_SeqId INTEGER;
DECLARE Padd_CorrId CHARACTER;
DECLARE Padding CHAR '000000000000000000000000000000000000000000000000';
DECLARE PaddLen INT 48;
DECLARE PaddValue INTEGER ;

SET Len_CorrId= LENGTH(CorrId);
SET Len_SeqId=LENGTH(SequenceId);

--Calculate the PaddValue
SET PaddValue= (PaddLen)-(Len_CorrId + Len_SeqId);
SET Padd_CorrId =(SeqId || CorrId || (SUBSTRING(Padding FROM Len_CorrId+1 FOR PaddValue)));

RETURN CAST(Padd_CorrId AS BLOB);
END;
_________________
Thanks
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Thu Jan 03, 2008 10:22 pm    Post subject: Reply with quote

Grand High Poobah

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

This is not really what you're looking for.
Char 00 and hex value 00 are not equivalent even with a CAST.

You should truly use the anonymous identifier pattern for the correlId.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
fschofer
PostPosted: Fri Jan 04, 2008 12:31 am    Post subject: Reply with quote

Knight

Joined: 02 Jul 2001
Posts: 524
Location: Mainz, Germany

Hi,

Quote:
Char 00 and hex value 00 are not equivalent even with a CAST.


If one cast a CHAR to BLOB without setting of CCSID and ECODING like SOLOHERO does the CHAR value will be directly converted 1:1 to a BLOB.

CAST('00' AS BLOB) result in x'00'

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/topic/com.ibm.etools.mft.doc/ak05680_.htm

Quote:
If you specify neither the CCSID nor ENCODING clause, the string must itself contain two-character hexadecimal digits of the form X'hhhhhh' or hhhhhh (where h can be any hexadecimal characters). In this case, the input string "436174" becomes the same three-byte binary array (43,61,74).
Note that an error is generated if the input string is not of the correct format.



Greetings
Frank
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Fri Jan 04, 2008 6:49 am    Post subject: Reply with quote

Grand High Poobah

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

Thanks for the update here , I'm learning every day with you guys.

Personally and to avoid confusion I would have used the form X'hhhhh'
_________________
MQ & Broker admin
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 » Padding in ESQL
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.