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 » asbitstream casting

Post new topic  Reply to topic
 asbitstream casting « View previous topic :: View next topic » 
Author Message
mbsa
PostPosted: Mon Mar 04, 2013 11:50 am    Post subject: asbitstream casting Reply with quote

Apprentice

Joined: 04 Mar 2013
Posts: 41

Trying to insert the cobol message in DB column.Used the asbitstream function,But getiing the below error.How do i cast?
Code:
DECLARE Msg BLOB;
      SET Msg = ASBITSTREAM(InputRoot.DFDL.IMSTRANRECORD CCSID InputRoot.Properties.CodedCharSetId Encoding InputRoot.Properties.Encoding);
      Declare Msg_Char CHAR;
      SET Msg_Char = CAST(Msg AS CHAR CCSID InputRoot.Properties.CodedCharSetId Encoding InputRoot.Properties.Encoding);
------------
BIP2521E: ('gen.operation1_Request_Response_Compute2.Main', '18.24') : Error casting the value ''X'11fc0000474b5230373620202020202020202020202020202020202020202020202020202020220202020202020202020202020202020''' to ''CHARACTER''.
An error occurred when casting a value to a different data type. This may be because no conversions exist between the two data types or because the particular value was unsuitable.

      


Last edited by mbsa on Mon Mar 04, 2013 12:34 pm; edited 1 time in total
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Mar 04, 2013 12:03 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Remove the CCSID and Encoding from the second CAST.
Back to top
View user's profile Send private message
mbsa
PostPosted: Mon Mar 04, 2013 12:42 pm    Post subject: Reply with quote

Apprentice

Joined: 04 Mar 2013
Posts: 41

Updated the second cast,but still same error.
Code:

SET Msg = ASBITSTREAM(InputRoot.DFDL.IMSTRANRECORD CCSID InputRoot.Properties.CodedCharSetId Encoding InputRoot.Properties.Encoding);
      Declare Msg_Char CHAR;
      SET Msg_Char = CAST(Msg AS CHAR);
SET OutputRoot.XMLNSC.DBMESSAGE.MessageIn = Msg_Char;


BIP2521E: ('gen.operation1_Request_Response_Compute2.Main', '18.24') : Error casting the value
An error occurred when casting a value to a different data type. This may be because no conversions exist between the two data types or because the particular value was unsuitable.[/code]
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Mar 04, 2013 1:07 pm    Post subject: Reply with quote

Grand High Poobah

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

Did you deploy that change?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mbsa
PostPosted: Mon Mar 04, 2013 1:10 pm    Post subject: Reply with quote

Apprentice

Joined: 04 Mar 2013
Posts: 41

I did remove the encoding ccsid before only but posted wrongly.The error is without ccsid and encoding in the second cast.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Mar 05, 2013 2:18 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

You are casting from BLOB to CHARACTER so the CCSID and encoding are required. Please can you provide details of the actual values of CCSID and encoding - perhaps from a user trace or a Trace node.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Mar 05, 2013 2:42 pm    Post subject: Reply with quote

Grand High Poobah

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

Don't use a CAST in the second statement, just straight assignment to get the hex values?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Wed Mar 06, 2013 1:13 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

fjb_saper said:
Quote:
Don't use a CAST in the second statement, just straight assignment to get the hex values?
It's a fair point. The OP has not said what the type of the database column is. I have been assuming that it's a CHAR or a VARCHAR because that's what the ESQL led me to believe.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Wed Mar 06, 2013 2:10 am    Post subject: Re: asbitstream casting Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

mbsa wrote:
Code:
DECLARE Msg BLOB;
SET Msg = ASBITSTREAM(InputRoot.DFDL.IMSTRANRECORD CCSID InputRoot.Properties.CodedCharSetId Encoding InputRoot.Properties.Encoding);

If the message contains a mix of character and non-character data, then a simple CAST won't reconstruct the original data. For example:

mbsa wrote:
Code:
BIP2521E: ('gen.operation1_Request_Response_Compute2.Main', '18.24') : Error casting the value "X'11fc0000...'"

that doesn't look like character data.

mbsa wrote:
The error is without ccsid and encoding in the second cast.

Check again. CAST(blob AS CHARACTER) should not generate a conversion error, without either a CCSID or Encoding clause.
Back to top
View user's profile Send private message
mbsa
PostPosted: Thu Mar 07, 2013 6:27 am    Post subject: Reply with quote

Apprentice

Joined: 04 Mar 2013
Posts: 41

Thanks for the reply.
The code is working.
The IMS copybook had binary header which we need to remove and then use the ccsid and encoding while casting to char.Thanks all.
Back to top
View user's profile Send private message
FelipeSchmidt
PostPosted: Sun Sep 15, 2013 5:09 am    Post subject: Re: asbitstream casting Reply with quote

Newbie

Joined: 13 Sep 2013
Posts: 1

mbsa wrote:
Trying to insert the cobol message in DB column.Used the asbitstream function,But getiing the below error.How do i cast?
[/code]DECLARE Msg BLOB;
SET Msg = ASBITSTREAM(InputRoot.DFDL.IMSTRANRECORD CCSID InputRoot.Properties.CodedCharSetId Encoding InputRoot.Properties.Encoding);
Declare Msg_Char CHAR;
SET Msg_Char = CAST(Msg AS CHAR CCSID InputRoot.Properties.CodedCharSetId Encoding InputRoot.Properties.Encoding);
------------
BIP2521E: ('gen.operation1_Request_Response_Compute2.Main', '18.24') : Error casting the value ''X'11fc0000474b5230373620202020202020202020202020202020202020202020202020202020220202020202020202020202020202020''' to ''CHARACTER''.
An
led lighting occurred when casting a value to a different data type. This may be because no conversions exist between the two data types or because the particular value was unsuitable.

[/code]


Hello friend I am getting similar code error so where you able to sort it out? Please help me if you can


Last edited by FelipeSchmidt on Mon Sep 16, 2013 7:19 am; edited 1 time in total
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Sep 15, 2013 7:12 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.

did you remove the binary header as the previous answer implied?
_________________
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
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » asbitstream casting
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.