|  | 
 
  
    | RSS Feed - WebSphere MQ Support | RSS Feed - Message Broker Support |  
 
  
	|    |  |  
  
	| Issue with declaration of constants in WMB v8 | « View previous topic :: View next topic » |  
  	| 
		
		
		  | Author | Message |  
		  | mattynorm | 
			  
				|  Posted: Tue Oct 29, 2013 6:37 am    Post subject: Issue with declaration of constants in WMB v8 |   |  |  
		  | Acolyte
 
 
 Joined: 06 Jun 2003Posts: 52
 
 
 | 
			  
				| We have a .esql file, in which all the constant variables we use are declared. However some are declared as a concatentation of an existing constant || additional naming information. 
 E.G.
 
 DECLARE	kServicesPrefix CONSTANT CHARACTER 'http://services';
 DECLARE 	kServices CONSTANT CHARACTER kServicesPrefix || '.company.com';
 DECLARE 	kBenchmark1 CONSTANT CHARACTER kServices || '/benchmarkService/1';
 
 would appear in the constants.esql file. This all worked fine and dandy under WMB 6109, however when I try to deploy a project that references this file using v8.0.0.2, the deployment fails with
 
 
 
   
	| Quote: |  
	| BIP2432E: (.kBenchmark1, 1.41) : The correlation name 'kServices' is not valid. Those in scope are: Add, Del, IncrementDate, kAckNotRequired, kAckRequired, kAlloc_STP, kAppBloomberg, kAppHpIdxPosAcct, kAppHpIdxPosCash, kAppHpIdxPosMoffx, kAppLatentZero, kAttachEmail, kBenchmark1. 
 The first element of a field reference must be a valid correlation name, from those in scope.
 |  
 In the Broker Development perspective I noticed the constants are displayed in alphabetical order, and  kBenchmark1 is the first constant alphabetically that is a part concatenation of an existing constant, so I'm guessing it would fail on all the others too.
 
 Anybody any idea as to why this is happening, and a potential fix\workaround?
 |  |  
		  | Back to top |  |  
		  |  |  
		  | Esa | 
			  
				|  Posted: Tue Oct 29, 2013 6:44 am    Post subject: Re: Issue with declaration of constants in WMB v8 |   |  |  
		  |  Grand Master
 
 
 Joined: 22 May 2008Posts: 1387
 Location: Finland
 
 | 
			  
				| 
   
	| mattynorm wrote: |  
	| Anybody any idea as to why this is happening, and a potential fix\workaround?
 |  
 Yes, there is a very simple workaround:
 
 
 
   
	| Code: |  
	| DECLARE kBenchmark1 CONSTANT CHARACTER 'http://services.company.com';
 |  
 
  |  |  
		  | Back to top |  |  
		  |  |  
		  | smdavies99 | 
			  
				|  Posted: Tue Oct 29, 2013 7:03 am    Post subject: |   |  |  
		  |  Jedi Council
 
 
 Joined: 10 Feb 2003Posts: 6076
 Location: Somewhere over the Rainbow this side of Never-never land.
 
 | 
			  
				| In  8.0.0.3 (Windows) this works 
 constants.esql
 
 
   
	| Code: |  
	| declare AF1 constant character 'Hello';
 declare AF2 constant character ' World';
 declare AF3 constant character AF1 || AF2;
 
 |  
 code.esql
 
 
   
	| Code: |  
	| set OutputRoot.XMLNSC.data.D1 = AF3;
 
 |  
 gives.
 
 
   
	| Code: |  
	| <data>
 <D1>Hello World</D1>
 </data>
 
 |  _________________
 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 |  |  
		  |  |  
		  | Esa | 
			  
				|  Posted: Tue Oct 29, 2013 11:37 am    Post subject: Re: Issue with declaration of constants in WMB v8 |   |  |  
		  |  Grand Master
 
 
 Joined: 22 May 2008Posts: 1387
 Location: Finland
 
 | 
			  
				| 
   
	| Esa wrote: |  
	| Yes, there is a very simple workaround:
 
 
 
   
	| Code: |  
	| DECLARE kBenchmark1 CONSTANT CHARACTER 'http://services.company.com';
 |  
 |  
 Oops, it seems I read the original post as carelessly as smdavies99 seems to have done. I should have written
 
 
 
   
	| Code: |  
	| DECLARE kBenchmark1 CONSTANT CHARACTER 'http://services.company.com/benchmarkService/1';
 |  
 @smdavies99:
 
 You should have tested this one instead:
 
 
 
   
	| Code: |  
	| declare AF3 constant character 'Hello'; declare AF2 constant character ' World';
 declare AF1 constant character AF3 || AF2;
 |  
 Another workaround is to rename the constants so that they are alphabetically ordered in order of appearence.
 
 Or you could change the compound constants into normal variables. That would, of course, mean that you would need to move them into the modules.
 But the constants are obviously referenced by several modules, otherwise it would have made only little sense to make them constants, wouldn't it?
 |  |  
		  | Back to top |  |  
		  |  |  
		  | mattynorm | 
			  
				|  Posted: Wed Oct 30, 2013 2:15 am    Post subject: |   |  |  
		  | Acolyte
 
 
 Joined: 06 Jun 2003Posts: 52
 
 
 | 
			  
				| Yeah, can't really be doing with renaming etc, as these are used all over the place. 
 The plot thickens a bit, in that I have created a TEST.esql file, copied all the constants into it, and deployed it as part of a library, and it works fine. Also, have noticed that (unlike the original file) there is no plus sign next to the esql, so you don't get a list of the constants in alphabetical order underneath the file.
 |  |  
		  | Back to top |  |  
		  |  |  
		  | Esa | 
			  
				|  Posted: Thu Oct 31, 2013 4:18 am    Post subject: |   |  |  
		  |  Grand Master
 
 
 Joined: 22 May 2008Posts: 1387
 Location: Finland
 
 | 
			  
				| Put the "root" constants in A.esql. Put derived constants in B.esql.
 Put constants derived from derived constants in C.esql.
 Etc.
 |  |  
		  | Back to top |  |  
		  |  |  
		  | NealM | 
			  
				|  Posted: Thu Nov 07, 2013 2:50 pm    Post subject: |   |  |  
		  |  Master
 
 
 Joined: 22 Feb 2011Posts: 230
 Location: NC or Utah (depends)
 
 | 
			  
				| I'd suggest you try FP3.  We had a couple issues with declared constants earlier this year, not the same issue as yours, but FP3 has soooo many APARs included, one may fix your problem. If that doesn't fix it, or if you would prefer to make 8.0.0.2 work, then its time to open a PMR.  The suggestions above are just work-arounds to a problem that needs fixing.
 |  |  
		  | Back to top |  |  
		  |  |  
		  |  |  |  
  
	|    |  | Page 1 of 1 |  
 
 
  
  	| 
		
		  | 
 
 | 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
 
 |  |  |  |