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 » Issue with Shared Variable -- Resolved

Post new topic  Reply to topic
 Issue with Shared Variable -- Resolved « View previous topic :: View next topic » 
Author Message
wraymore
PostPosted: Wed Jul 02, 2008 8:39 am    Post subject: Issue with Shared Variable -- Resolved Reply with quote

Centurion

Joined: 16 Aug 2005
Posts: 114
Location: Burlington, NC USA

WMB6.0.2 Toolkit
WMB6.0.0.6 Runtime
AIX5.3.#

In a simple message flow - Input node; Compute Node; Output Node

I am wanting to use a shared variables to keep an incremented index value and to keep some counters.

I have declared the Shared Variables in the ESQL outside the Compute odule:

DECLARE phnIndex SHARED INTEGER 1;
DECLARE msgCnt SHARED INTEGER 0;
DECLARE totPageCnt SHARED INTEGER 0;
DECLARE tot3PageCnt SHARED INTEGER 0;
CREATE COMPUTE MODULE XMLMessage_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN BEGIN


Within the ESQL I reference the variables as any other variable:

SET msgCnt = msgCnt + 1;


CASE phnIndex
WHEN 1 THEN
SET OutTriadDestInfo.triadNS:DeviceId = phnNbr1;
WHEN 2 THEN
SET OutTriadDestInfo.triadNS:DeviceId = phnNbr2;
WHEN 3 THEN
SET OutTriadDestInfo.triadNS:DeviceId = phnNbr3;
ELSE
SET OutTriadDestInfo.triadNS:DeviceId = phnNbr4;
END CASE;

SET phnIndex = phnIndex + 1;

IF phnIndex > 4 THEN
SET phnIndex = 1;
END IF;

CASE msgCnt
WHEN 400 THEN
SET OutTriadDestInfo.triadNS:DeviceId = phnNbrA;
SET phnIndex = 1;
WHEN 800 THEN
SET OutTriadDestInfo.triadNS:DeviceId = phnNbrA;
SET phnIndex = 1;
WHEN 1200 THEN
SET OutTriadDestInfo.triadNS:DeviceId = phnNbrB;
SET phnIndex = 1;
WHEN 1600 THEN
SET OutTriadDestInfo.triadNS:DeviceId = phnNbrB;
SET phnIndex = 1;
END CASE;


SET pageCnt = OutTriadPayload.triadNS:Payload[1].(XMLNSC.Attribute)pages;

IF pageCnt = 3 THEN
SET tot3PageCnt = tot3PageCnt + pageCnt;
END IF;

SET totPageCnt = totPageCnt + pageCnt;
SET Environment.ScratchPad.PageCnt = totPageCnt;
SET Environment.ScratchPad.ThreePageCnt = tot3PageCnt;
SET Environment.ScratchPad.MsgCnt = msgCnt;



In the message flow User Defined Properties Tab, I have added the four items listed above.

I have built a *.bar file that contains the messageflow.cfm and have verified that the initial values are as above.

However when I deploy the bar file, I receive the following errors:

BIP4055E: (.DBSchemaQualifier, 1.1) : User defined attribute must specify an initial value expression.
User defined attributes must either be given an initial value on the DECLARE statement or be given a value at deploy time.
Set the value of the User Defined Attribute at deploy time.


BIP4001E: Syntax error in SQL statements in node XMLMessage.Compute'.
The configuration failed due to errors in the SQL statement text. See the following messages for details of the error
The following error messages will give specific details of the location and nature of the error. Check and correct the syntax of the SQL statements and redeploy.



I have tried removing the initial values from the Declare statement and set them in the Message Floe Editor User Defined Properties Tab. I have tried setting the values to something totally different in the bar file, but still keep getting the same response. Can anyone provide me some guidance.


Last edited by wraymore on Wed Jul 02, 2008 9:16 am; edited 1 time in total
Back to top
View user's profile Send private message
wraymore
PostPosted: Wed Jul 02, 2008 9:14 am    Post subject: Reply with quote

Centurion

Joined: 16 Aug 2005
Posts: 114
Location: Burlington, NC USA

Found my mistake, I needed to setup a Broker Schema. Once that was there the bar file deployed without errors.

Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Jul 02, 2008 9:15 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.

From my experience with this sort of thing, I didn't need to use any 'User Defined Properties' at all.

I added some comments about this here
[url]http://www.mqseries.net/phpBB2/viewtopic.php?t=44168[/url]
the other day.
Here is a code snippett
[code]
DECLARE MSG_COUNT shared integer 0;
DECLARE ERR_COUNT shared integer 0;
DECLARE ACK_COUNT shared integer 0;

create procedure Update_Counters( IN Type Integer, OUT Distrib Integer)
begin
begin ATOMIC
CASE
WHEN Type = 1 THEN
set MSG_COUNT = MSG_COUNT + 1;
WHEN Type = 2 THEN
set ERR_COUNT = ERR_COUNT + 1;
WHEN Type = 3 THEN
set ACK_COUNT = ACK_COUNT + 1;

END CASE;

--
-- Finally, update the distribuion broker number for this message
--
if Type < 5 then
if SYSTEM_DISTRIB = SYSTEM_DISTRIB_MAX then
set SYSTEM_DISTRIB = 1;
else
set SYSTEM_DISTRIB = LERPS_ER_DISTRIB + 1;
end if;
end if;
set Distrib = SYSTEM_DISTRIB;
end;
end;[/code]
This code allows multiple instances of the same flow to correctly keep message counts and to send the output messages to different destination queues (based upon SYSTEM_DISTRIB).
_________________
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 » Issue with Shared Variable -- Resolved
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.