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 » how to convert string to ASCII by using ccsid or encoding

Post new topic  Reply to topic
 how to convert string to ASCII by using ccsid or encoding « View previous topic :: View next topic » 
Author Message
christopher j
PostPosted: Tue Jul 06, 2010 10:20 am    Post subject: how to convert string to ASCII by using ccsid or encoding Reply with quote

Novice

Joined: 01 Jan 2010
Posts: 20

hi
could you please help me to convert string(contains numbers ad alphabets) to ASCII by using ccsid or encoding
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jul 06, 2010 10:30 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

We will - but only if you tell us where you have looked for the answer, and what you have tried. We only give out free help to people who have made an effort to find the answer for themselves.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jul 06, 2010 11:44 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kimbert wrote:
We will - but only if you tell us where you have looked for the answer, and what you have tried. We only give out free help to people who have made an effort to find the answer for themselves.




You might also want to give us a clue about what this string is being converted from. Also the platforms involves, versions of WMQ in use and if this is an unloaded COBOL copybook moving from z/OS.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jul 06, 2010 12:10 pm    Post subject: Reply with quote

Grand High Poobah

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

Vitor,

Think of string as a loose companion in .NET to java.lang.String... with string being a in a Unicode representation...

Now Christopher could also be talking about C/C++?...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Tue Jul 06, 2010 12:19 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

fjb_saper wrote:
Think of string as a loose companion in .NET to java.lang.String... with string being a in a Unicode representation...


Oh Lord - Java!

Run away, run away.....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jul 06, 2010 12:24 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

fjb_saper wrote:
Vitor,

Think of string as a loose companion in .NET to java.lang.String... with string being a in a Unicode representation...

Now Christopher could also be talking about C/C++?...


But given that we're in The Broker forum, it's likely an ESQL CHARACTER variable.
Back to top
View user's profile Send private message
christopher j
PostPosted: Wed Jul 07, 2010 11:46 am    Post subject: Reply with quote

Novice

Joined: 01 Jan 2010
Posts: 20

I am trying in a below way to convert CHARACTER into ASCII
DECLARE rec CHARACTER;
SET rec='1811 ';
SET Environment.Variables.blobREC=CAST(rec as BLOB CCSID 819)

But i am not sure whether this conversion is correct.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jul 07, 2010 1:05 pm    Post subject: Reply with quote

Grand High Poobah

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

christopher j wrote:
I am trying in a below way to convert CHARACTER into ASCII
DECLARE rec CHARACTER;
SET rec='1811 ';
SET Environment.Variables.blobREC=CAST(rec as BLOB CCSID 819)

But i am not sure whether this conversion is correct.

Looks correct to me.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Wed Jul 07, 2010 9:23 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

So, you are using 8859-1 as your character set.
What happens when you want to encode (and later decode properly) a character that is not in 8859-1 like say a Euro Symbol?
Then you will need 8859-15 (aka 923)

Unless you understand totally the limitations of casting to a non UTF character set please don't hard code the CCSID.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Jul 08, 2010 1:51 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
But i am not sure whether this conversion is correct.

Two questions:
- What, specifically, are you 'not sure' about? Are you asking us to confirm that your CAST statement looks OK ( it does to me )?
- What's special about CCSID 819? Why not use a Unicode code page, which will always be safe?
Back to top
View user's profile Send private message
christopher j
PostPosted: Thu Jul 08, 2010 9:51 am    Post subject: Reply with quote

Novice

Joined: 01 Jan 2010
Posts: 20

When i am casting ' ' (space) to an ascii value, ccsid-819 converts it into 20.But the actual ascii value for ' ' is 32.How to achieve that?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Jul 08, 2010 10:15 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Ask yourself what the HEX representation of 32 is
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Jul 08, 2010 11:22 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Can I just ask an important question? Why do you want to convert this string to ASCII? What is your message flow trying to do, that requires this?
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 » how to convert string to ASCII by using ccsid or encoding
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.