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 » Dynamically create a variable name

Post new topic  Reply to topic
 Dynamically create a variable name « View previous topic :: View next topic » 
Author Message
WMB_User
PostPosted: Sun Aug 08, 2010 8:38 am    Post subject: Dynamically create a variable name Reply with quote

Apprentice

Joined: 17 Nov 2008
Posts: 31

WMB 6.1.0.4

I need to construct the name of a variable using some static values and also a value that's been assigned to another variable. Confused ? Perhaps a sample of what I'm trying to accomplish will provide some insight.

Code:
DECLARE FatalAction_FA1_EmailDistributionList  EXTERNAL of CHARACTER 'john.smith@yahoo.com';
DECLARE FatalAction_FA2_EmailDistributionList  EXTERNAL CHARACTER 'jane.doe@yahoo.com';

SET OutputRoot.EmailOutputHeader.To  = 'FatalAction_' || Environment.FA_Status || '_EmailDistributionList';

** where Environment.FA_Status contains either 'FA1' or 'FA2'

I know this sample will only assign the value 'FatalAction_FA1_EmailDistributionList' to EmailOutputHeader.TO rather than the value that the FatalAction_FA1_EmailDistributionList variable contains.

Any thoughts?

Can this be done using the FIELDVALUE function?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Aug 08, 2010 11:44 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.

Why?

Can't this be done in other ways?
For example a structure with one field containing the variable name and another with its value.
_________________
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
WMB_User
PostPosted: Sun Aug 08, 2010 12:19 pm    Post subject: Reply with quote

Apprentice

Joined: 17 Nov 2008
Posts: 31

Yes, but I'd prefer doing this with one statement if at all possible.

I seem to remember that there's a way to do it, but can't remember how it was done.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sun Aug 08, 2010 2:59 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You mean { } ?

It only works for a single level, so if you need to OutputRoot.X.Y.Z, you need OutputRoot.{XVar}.{YVar}.{ZVar}.
Back to top
View user's profile Send private message
inMo
PostPosted: Mon Aug 09, 2010 9:24 am    Post subject: Reply with quote

Master

Joined: 27 Jun 2009
Posts: 216
Location: NY

Have you considered assigning the addrs to a tree structure like Environment.EmailList.FA1 and Environment.EmailList.FA2 and using the contents of that tree for population?
Back to top
View user's profile Send private message
Amitha
PostPosted: Mon Aug 09, 2010 11:32 am    Post subject: Reply with quote

Voyager

Joined: 20 Nov 2009
Posts: 80
Location: Newyork

Did you try using EVAL Function?

http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ak05020_.htm
Back to top
View user's profile Send private message Send e-mail
WMB_User
PostPosted: Mon Aug 09, 2010 3:45 pm    Post subject: Reply with quote

Apprentice

Joined: 17 Nov 2008
Posts: 31

That was the solution.

Thanks !

Code:
SET OutputRoot.EmailOutputHeader.To  =  EVAL('FatalAction_' || envRef.Enrichment.Status || '_EmailDistributionList');
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 » Dynamically create a variable name
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.