| Author | 
		  Message
		 | 
		
		  | stiffann | 
		  
		    
			  
				 Posted: Tue Jul 02, 2002 1:31 am    Post subject: How do I define global variables | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 17 Mar 2002 Posts: 26
  
  | 
		  
		    
			  
				Hi all,
 
 
I would like to define a global variable, a counter for instance, that would be accessible by all my message flows deployed in a particular Execution Group.
 
The aim of it is to increment a counter each time a message flow is invoked, and to trigger a specific action when the counter has a specific value.
 
 
Thank you in advance !!    | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | nico_fr | 
		  
		    
			  
				 Posted: Tue Jul 02, 2002 1:53 am    Post subject: Environement variables | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 29 May 2002 Posts: 2 Location: France 
  | 
		  
		    
			  
				In WMQI 2.1 you can save your values in the "Environement" variable.
 
ex:
 
"SET Environment.Variables.MyError='y error';"
 
 
Consequenly you'll have in memory during all the messageflow the value:
 
${Environment} :
 
(
 
  (0x1000000)Variables = (
 
    (0x3000000)MyError = 'My error'
 
  ) | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | stiffann | 
		  
		    
			  
				 Posted: Tue Jul 02, 2002 2:15 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 17 Mar 2002 Posts: 26
  
  | 
		  
		    
			  
				The official IBM documentation (Working with Messages) says that "an empty Environment tree is created when a message is received by the input node and parsed. It has no structure or content until you populate it using ESQL statements".
 
 
So, that's why I thought that the variables created were only visible within the concerned message flow and for the concerned message.
 
 
I'll try some experimentations to verify your information.
 
 
Thanks ! | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | stiffann | 
		  
		    
			  
				 Posted: Tue Jul 02, 2002 2:54 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 17 Mar 2002 Posts: 26
  
  | 
		  
		    
			  
				As I said before, and after having experimented by myself, it seems that the "Environment" tree is created for each new message. It means that I can't store global variables in this tree.
 
 
If someone else has a good idea for that, I'm still listening to you !    
 
 
Thanks in advance | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | CodeCraft | 
		  
		    
			  
				 Posted: Tue Jul 02, 2002 3:53 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Disciple
 
 Joined: 05 Sep 2001 Posts: 195
  
  | 
		  
		    
			  
				Have a check around the IBM Support Packs.  I think I heard before of someone writing a node that had shared memory handling for variables between flows.
 
 
The alternative, a two column one row table in a database:
 
 
  Create Table Counter
 
  ( MyKey Char(15) Primary Key,
 
     MyValue Integer
 
  )
 
 
You might be able to do some tuning to ensure that table remains cached.  Can't think of anything nicer right now. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |