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 » Truncation of Bytes using LEFT

Post new topic  Reply to topic
 Truncation of Bytes using LEFT « View previous topic :: View next topic » 
Author Message
chenna.hari
PostPosted: Sun Mar 20, 2011 7:50 am    Post subject: Truncation of Bytes using LEFT Reply with quote

Centurion

Joined: 21 Mar 2009
Posts: 103

this is regarding truncation to restricted length using LEFT

we have a requirement to truncate a string to 50 bytes

we have done as below

LEFT(CAST(InputRoot.XMLNSC.inputelement AS BLOB CCSID 1208), 50)

and then CAST to CHAR again.

in Some cases we are getting error as unconvertible character. because we are truncating the bytes, if the input string contains multibyte character, and if we try to truncate it to half of the byte, it is giving error while convert back to Character.

Can any one suggest how to resolve this error?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sun Mar 20, 2011 10:14 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Do all your truncating with a character representation.

Use the bytes representation to only check if the length is too long.

Or do the right thing, and change the field to accept 50 characters rather than 50 bytes.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Sun Mar 20, 2011 12:43 pm    Post subject: Re: Truncation of Bytes using LEFT Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

Or, to truncate bytes, it might help to know that for a well-formed UTF-8 sequence, the first byte of a multi-byte character lies within the range C2..F4, while the remaining bytes lie within the range 80..BF.
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 » Truncation of Bytes using LEFT
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.