| Author | 
		  Message
		 | 
		
		  | CuriCAT | 
		  
		    
			  
				 Posted: Tue Oct 21, 2008 7:55 pm    Post subject: Convert Environment tree into CHAR | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 26 Sep 2006 Posts: 82
  
  | 
		  
		    
			  
				I have this tree in environment variable.
 
 
Environment
 
                ---- xyz
 
                     ------a = 10
 
                     ------b = 20
 
                     ------c = 30
 
 
I want to conver Environment.xyz intto Char , I mean as one single string. I am not able to .. 
 
 
 
I tried this
 
 
       SET  v_abc =  CAST( ASBITSTREAM(Environment.xyz) AS CHAR)
 
 
Can you please tell me am I missing something ? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | broker_new | 
		  
		    
			  
				 Posted: Wed Oct 22, 2008 4:21 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Yatiri
 
 Joined: 30 Nov 2006 Posts: 614 Location: Washington DC 
  | 
		  
		    
			  
				First CAST  it as BLOB and then CAST the result as CHAR _________________ IBM ->Let's build a smarter planet | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Wed Oct 22, 2008 4:26 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				There is no parser associated with the Environment tree.  Ergo, there's nothing for ASBITSTREAM to use to serialize the tree.
 
 
Fortunately, CREATE FIELD has a DOMAIN clause. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | CuriCAT | 
		  
		    
			  
				 Posted: Thu Oct 23, 2008 8:43 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 26 Sep 2006 Posts: 82
  
  | 
		  
		    
			  
				| Can some body give an example for that.. I tried declaring blob variable .. etc. nothing worked. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Thu Oct 23, 2008 8:53 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				Create Field Environment.Data DOMAIN XMLNSC;
 
 
Set Environment.Data.XMLNSC.Root.Field1 = 'a';
 
 
Set Environment.Output = ASBITSTREAM(Environment.Data.XMLNSC);
 
 
or some such.
 
 
caveat coder. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | CuriCAT | 
		  
		    
			  
				 Posted: Thu Oct 23, 2008 9:26 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 26 Sep 2006 Posts: 82
  
  | 
		  
		    
			  
				I want to do this :
 
 
 
DECLARE xyzTableRef REFERENCE TO  Environment.WORKAREA.xyzTable;
 
 
SET xyzTableRef.Data[] = (SELECT T.* FROM Database.{v_Schema}.TABLENAME AS T);
 
 
then I want to convert this xyzTableRef to a string. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | marko.pitkanen | 
		  
		    
			  
				 Posted: Thu Oct 23, 2008 10:01 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Chevalier
 
 Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland 
  | 
		  
		    
			  
				Hi,
 
 
I wonder if it works when you just create your xyzTable with domain declaration:
 
 
Create Field  Environment.WORKAREA.xyzTable DOMAIN XMLNSC
 
 
and then serialize object -tree as bitstream and then cast the bitstream as char: 
 
CAST( ASBITSTREAM(Environment.WORKAREA.xyzTable) AS CHAR)
 
and perhaps you need to use CCSID in our cast operation to get our string in right character set.
 
 
Marko | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | CuriCAT | 
		  
		    
			  
				 Posted: Fri Oct 24, 2008 9:14 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Voyager
 
 Joined: 26 Sep 2006 Posts: 82
  
  | 
		  
		    
			  
				Still I couldn't manage to do this...  If I can convert a part of environment tree to BLOB enough..  but ASBITSTREAM is not helping me me   | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | marko.pitkanen | 
		  
		    
			  
				 Posted: Mon Oct 27, 2008 1:32 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Chevalier
 
 Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland 
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |