|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
ESQL Help |
« View previous topic :: View next topic » |
Author |
Message
|
pfaulkner |
Posted: Tue Aug 13, 2002 1:54 pm Post subject: ESQL Help |
|
|
Master
Joined: 18 Mar 2002 Posts: 241 Location: Colorado, USA
|
Hi,
I need to be able to extract information from my source queue name in order to build a destination queue name.
I assume I can access the source queue name from MQMD.SourceQueue?
If my queue name as a variable length format like part1.part2.part3.part4
How can I extract the information using ESQL so I end up with seperate fields called part1, part2, part3, part4?
And how do I put them back together?
thanks |
|
Back to top |
|
 |
kirani |
Posted: Tue Aug 13, 2002 2:51 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Yes, you can get input queue name from MQMD.SourceQueue.
Here is pseudo code for extracing different parts from input queue. I am assuming that the input queue name will be always in part1.part2.part3.part4 format.
Code: |
newfield = MQMD.SourceQueue;
i =1;
j=0;
stpos = 1;
while ( i<=4 ) DO
j = position ('.' in newfield);
Environment.var[i] = substring (newfield from stpos FOR j-1);
stpos = j+1;
newfield = substring (newfield from stpos);
i = i+1;
end while;
|
Here .. different parts of queue name are stored into Environment tree. You could change these values and then create output queue name by ..
Code: |
outputqueuename = Environment.var[1] || '.' || Environment.var[2] || '.' || Environment.var[3] || '.' || Environment.var[4];
|
Hope this helps. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
pfaulkner |
Posted: Wed Aug 14, 2002 8:37 am Post subject: |
|
|
Master
Joined: 18 Mar 2002 Posts: 241 Location: Colorado, USA
|
thanks, I've attached the actual code just incase anyone else is interested. I did have to make 1 or 2 minor changes to make it work.
Thanks again.
-- Sets Destination Queue & Queue Manager
DECLARE newfield CHARACTER;
DECLARE i INTEGER;
DECLARE j INTEGER;
DECLARE stpos INTEGER;
SET newfield = InputRoot.MQMD.SourceQueue;
SET i=1;
SET j=0;
SET stpos = 1;
while (i<=6) DO
SET j = position ('.' in newfield);
if j = 0 then
-- '.' not found (last field)
SET Environment.var[i] = rtrim(substring (newfield from stpos));
else
-- '.' found
SET Environment.var[i] = substring (newfield from stpos FOR j-1);
SET stpos = j+1;
SET newfield = substring (newfield from stpos);
end if;
SET i = i+1;
SET stpos = 1;
end while;
SET InputLocalEnvironment.Destination.MQ.DestinationData[1].queueName = Environment.var[1] || '.' || Environment.var[2] || '.' || Environment.var[3] || '.' || Environment.var[4];
SET InputLocalEnvironment.Destination.MQ.DestinationData[1].queueManagerName = Environment.var[6]; |
|
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
|
|
|
|