|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Inserting values into field array based on index. |
« View previous topic :: View next topic » |
Author |
Message
|
Blomman |
Posted: Tue Jul 27, 2010 6:25 am Post subject: Inserting values into field array based on index. |
|
|
Master
Joined: 31 Oct 2006 Posts: 230
|
Hi!
I have an simple issue that im sure there are many ways to solve it...
Whit in an LOOP:
I want to put an value of variable "MetadataListEntry" into index "i" in "InputLocalEnvironment.Variables.MetaList.List[]"
What i want to do:
Code: |
SET InputLocalEnvironment.Variables.MetaList.List[] = LIST{'test1','test2','test3'};
|
But i want to do it based on index in LOOP,some thing like this.
OBS!
Variable MetaDataListaEntry gets an new value each turn in loop but i havent included that logic here.
Code: |
DECLARE i INTEGER 1;
Z : LOOP
IF i > 10 THEN
LEAVE Z;
ELSE
SET InputLocalEnvironment.Variables.MetaList[i].List[] = LIST{MetadataListEntry};
END IF;
SET i = i + 1;
END LOOP Z; |
Best Regards!
//Micke |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Jul 27, 2010 7:39 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
firstly, you can't update the InputLocalEnvironment only the OutputLocalEnvironment
Secondly, why don't you use a FOR loop? you are looping 10 times _________________ 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 |
|
 |
fjb_saper |
Posted: Tue Jul 27, 2010 7:41 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Bad move.
If you want to use indexes be aware of the cost.
Usually with loops like this you should be using a reference.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mgk |
Posted: Tue Jul 27, 2010 9:07 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Quote: |
firstly, you can't update the InputLocalEnvironment only the OutputLocalEnvironment |
Actually you can .
regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Jul 27, 2010 11:09 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
mgk wrote: |
Quote: |
firstly, you can't update the InputLocalEnvironment only the OutputLocalEnvironment |
Actually you can .
regards, |
Perhaps I should have said 'You Shouldn't ...'.
In all honesty, I have yet to come upon a compelling reason to even want to do this. After all you are making changes to something that will dissapear when you exit the node. If you wanted to keep it, why not copy it first or copy & modify in one go.
But hey, that is my preference. I prefer the separation of Input & Outputs but that is probably due to my Control Systems Eng Background more than anything
 _________________ 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 |
|
 |
|
|
 |
|
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
|
|
|
|