| Author | 
		  Message
		 | 
		
		  | rohank84 | 
		  
		    
			  
				 Posted: Wed Sep 15, 2010 5:35 am    Post subject: Convert Character to Blob | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 31 Dec 2008 Posts: 109
  
  | 
		  
		    
			  
				Hi Guys, 
 
 
I need to convert a Character string to Blob. 
 
 
I tried using ASBITSTREAM and it gave following error.
 
 
I tried doing this - 
 
DECLARE Message BLOB;
 
DECLARE MessageBody CHARACTER; 
 
SET Message = ASBITSTREAM(MessageBody OPTIONS options CCSID 1208);
 
 
It seems it does not expect a character input.
 
 
Error - "Illegal type for parameter '1' of the function 'ASBITSTREAM'. A non-list field reference is required. "
 
 
I there  any way to convert character to blob.
 
 
I am using WMB 6.1. 
 
 
Thanks in advance | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Wed Sep 15, 2010 5:50 am    Post subject: Re: Convert Character to Blob | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| rohank84 wrote: | 
   
  
	| I need to convert a Character string to Blob.  | 
   
 
 
 
Why?
 
 
   
	| rohank84 wrote: | 
   
  
	| It seems it does not expect a character input. | 
   
 
 
 
No it doesn't.
 
 
   
	| rohank84 wrote: | 
   
  
	| I there  any way to convert character to blob. | 
   
 
 
 
You could cast it. It really depends why you feel you need to do this. _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | rohank84 | 
		  
		    
			  
				 Posted: Wed Sep 15, 2010 11:41 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 31 Dec 2008 Posts: 109
  
  | 
		  
		    
			  
				Hi Vitor, 
 
 
Thanks for the reply. 
 
 
The reason why i need this is because i am making an application where message body is not relevant and it should be a any alphanumeric characters of specific size. 
 
The destination application where i am putting this message expects it as a BLOB and and I am setting this character string into BLOB.
 
 
SET MessageBody = '@@@@@@@@@';
 
SET OutputRoot.BLOB.BLOB = MessageBody;
 
 
And ofcourse this gives an error as you cannot do that.
 
 
 
I tried casting it but there seems no way to cast a CHARACTER to BLOB. 
 
 
I know BLOB can take any inputs but the destination system expects a BLOB and I unfortunately i cant change that . 
 
I can say this because i have made a sample application where i set BLOB and the destination system works ...
 
 
The message which i construct have a RFH2 header and the body. I tried putting RCD node and configured it to take BLOB domain and reset the message domain option. 
 
 
When i try this the message which is played is crappy. It has the RFH2 header and Message Body but the destination system doesnt understand that the message has a RFH2 header and fails. 
 
 
Do you feel the setting the MQMD format to MQRFH2 might help. 
 
 
 
 
Thanks in advance
  Last edited by rohank84 on Wed Sep 15, 2010 11:47 am; edited 1 time in total | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Wed Sep 15, 2010 11:43 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				You use the CAST statement to CAST a CHARACTER to a BLOB.
 
 
As documented.
 
 
Happy Reading. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | rohank84 | 
		  
		    
			  
				 Posted: Wed Sep 15, 2010 11:51 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 31 Dec 2008 Posts: 109
  
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Wed Sep 15, 2010 12:03 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Wed Sep 15, 2010 12:14 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				
 
MessageBody is a BAD choice of identifier for a Character variable.
 
See the default Tree identifiers in the infocenter.
 
Use something like mymsgtxt or anything else that does not map to a tree or a  reference with children...
 
 
Have fun   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | rohank84 | 
		  
		    
			  
				 Posted: Thu Sep 16, 2010 10:31 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 31 Dec 2008 Posts: 109
  
  | 
		  
		    
			  
				Hi Guys, 
 
 
The casting thing worked. I did the same thing but broker seems to be not taking the change. 
 
I changed the variable name as well. 
 
 
Thanku guys for your time and help ...
 
 
Enjoy   | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |