Author |
Message
|
kash3338 |
Posted: Thu Jun 04, 2009 4:52 am Post subject: Difference between variables |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
Hi,
Can anyone tell me the difference between,
Environment.Variable.cTemp
Environment.Variables.cTemp and
OutputLocalEnvironment.Variables.cTemp.
What is the basic difference between them and which is more efficient to use? |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 04, 2009 4:57 am Post subject: Re: Difference between variables |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kash3338 wrote: |
What is the basic difference between them and which is more efficient to use? |
The basic difference is the last one is stored in a different place to the top 2, has a different scope and is hence used in different situations.
The documentation explains the difference between Environment & LocalEnvironment quite well. In concept it's the same difference as a global variable & a local variable. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jun 04, 2009 7:07 am Post subject: Re: Difference between variables |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
kash3338 wrote: |
Environment.Variable.cTemp
Environment.Variables.cTemp |
There is no meaningful difference between these two. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 04, 2009 7:27 am Post subject: Re: Difference between variables |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
kash3338 wrote: |
Environment.Variable.cTemp
Environment.Variables.cTemp |
There is no meaningful difference between these two. |
The quality & detail of my posts is diminishing. Shouldn't post while trouting the on-site unworthy  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
rekarm01 |
Posted: Thu Jun 04, 2009 1:14 pm Post subject: Re: Difference between variables |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
mqjeff wrote: |
kash3338 wrote: |
Environment.Variable.cTemp
Environment.Variables.cTemp |
There is no meaningful difference between these two. |
... except that IBM documents only the Environment.Variables subtree for use by the message flow developer:
Quote: |
If you want to create your own information, create it in the environment tree within a subtree called Variables. |
|
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jun 05, 2009 3:18 am Post subject: Re: Difference between variables |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
rekarm01 wrote: |
... except that IBM documents only the Environment.Variables subtree for use by the message flow developer:
Quote: |
If you want to create your own information, create it in the environment tree within a subtree called Variables. |
|
That's a switch.
It still doesn't make a difference, unless someone's gone out of their way to introduce hidden changes in this since version 6.0. Which isn't likely.
Certainly Environment.Variables is a "well known" location, but there should be no discernable behavior differences between storing your own data there and any other location under Environment. Unless there is more documentation that I've missed that says otherwise, of course. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jun 05, 2009 3:31 am Post subject: Re: Difference between variables |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
rekarm01 wrote: |
... except that IBM documents only the Environment.Variables subtree for use by the message flow developer:
Quote: |
If you want to create your own information, create it in the environment tree within a subtree called Variables. |
|
That's a switch.
It still doesn't make a difference, unless someone's gone out of their way to introduce hidden changes in this since version 6.0. Which isn't likely.
Certainly Environment.Variables is a "well known" location, but there should be no discernable behavior differences between storing your own data there and any other location under Environment. Unless there is more documentation that I've missed that says otherwise, of course. |
The link quoted does indeed say that, but the diagram immediately under it describes it as "an example of an Environment tree" (the italics are mine). IMHO this link is suggesting rather than defining.
FWIW this site uses Environment rather more than I approve of but it doesn't cause more ill effects than you'd expect to have:
Code: |
Environment.SystemA.TransactionId
Environment.SystemA.OriginalMsgId
Environment.SystemB.TransactionId
Environment.SystemB.Mode
etc
etc
|
i.e. multiple "Variables" trees under Environment. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
rekarm01 |
Posted: Sun Jun 07, 2009 12:39 pm Post subject: Re: Difference between variables |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
mqjeff wrote: |
rekarm01 wrote: |
... except that IBM documents only the Environment.Variables subtree for use by the message flow developer:
Quote: |
If you want to create your own information, create it in the environment tree within a subtree called Variables. |
|
It still doesn't make a difference, unless someone's gone out of their way to introduce hidden changes in this since version 6.0. Which isn't likely.
Certainly Environment.Variables is a "well known" location, but there should be no discernable behavior differences between storing your own data there and any other location under Environment. Unless there is more documentation that I've missed that says otherwise, of course. |
The difference is that the documentation recommends the former, and does not recommend the latter. This might be an inconsequential difference, as it's merely a recommendation rather than a requirement, but it's still worth pointing out, particularly in response to a direct question about what the difference is.
There is no discernible difference in behavior between the two, unless the location of user-defined data happens to conflict with the location of any broker-defined data. (For example, Environment.Broker.Accounting.Origin would be a bad place to store unrelated user-defined data.)
Even if there is no conflict with the current version of the broker, there's no assurance that a future broker upgrade won't introduce a conflict ... unless the user follows the recommended practice, confining user-defined data within a Variables subtree. |
|
Back to top |
|
 |
Vitor |
Posted: Sun Jun 07, 2009 2:55 pm Post subject: Re: Difference between variables |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
rekarm01 wrote: |
There is no discernible difference in behavior between the two, unless the location of user-defined data happens to conflict with the location of any broker-defined data. (For example, Environment.Broker.Accounting.Origin would be a bad place to store unrelated user-defined data.) |
Not an ideal example - it's no worse than storing user data in any other accounting field (which is not best practice obviously).
rekarm01 wrote: |
Even if there is no conflict with the current version of the broker, there's no assurance that a future broker upgrade won't introduce a conflict ... unless the user follows the recommended practice, confining user-defined data within a Variables subtree. |
If that happens, this site is seriously hosed!
The point here we can all agree on is that there is a documented IBM recommendation (not a requirement), so not following this recommendation carries the same weight & risk as not following any other. And though it's the recommended practice, it's not a requirement. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|