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 » Array in Database

Post new topic  Reply to topic
 Array in Database « View previous topic :: View next topic » 
Author Message
vickykarumbhu
PostPosted: Mon Jun 08, 2015 11:52 pm    Post subject: Array in Database Reply with quote

Newbie

Joined: 08 Jun 2015
Posts: 6

Hi All,
I have fetched two fields from DB using passthrough function and stored it in environment variables. I need to declare a reference to point tat environment variables. But if in specify like this I am getting only the first instance DECLARE newref REFERENCE TO Environment.Variables.ODList[ODList];. Please help me on this
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Jun 09, 2015 1:04 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.

Can a moderator please move this post to the Broker forum

To the OP, can you please show us a bit more of the code in order to help set the context a bit better. Please include the PASSTHRU line as well.
_________________
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
vickykarumbhu
PostPosted: Tue Jun 09, 2015 1:19 am    Post subject: Reply with quote

Newbie

Joined: 08 Jun 2015
Posts: 6

SET Environment.Variables.ODList[ODListcount] = PASSTHRU('SELECT s.filed1,s.field2 FROM dev1.table AS s');
Both the field1 and 2 values are present under ODLIST as
WMQI_Environment
Variables
ODList
AIRPORT_CODE:CHARACTER:AAL
COUNTRY:CHARACTER:DK
ODList
AIRPORT_CODE:CHARACTER:AAR
COUNTRY:CHARACTER:DK
and so on...
DECLARE newref REFERENCE TO Environment.Variables.ODList[ODList];//This reference points only to the first value of odlist
WHILE LASTMOVE (newref) DO
IF (DepRef = Environment.Variables.ODList[ODList].AIRPORT_CODE) THEN
SET DomesticFlag = 1;
END IF;
MOVE newref NEXTSIBLING REPEAT TYPE NAME;
END WHILE;
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Jun 09, 2015 2:03 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.

Code:

SET Environment.Variables.ODList[ODListcount] = PASSTHRU('SELECT s.filed1,s.field2 FROM dev1.table AS s');
Both the field1 and 2 values are present under ODLIST as
WMQI_Environment
Variables
ODList
AIRPORT_CODE:CHARACTER:AAL
COUNTRY:CHARACTER:DK
ODList
AIRPORT_CODE:CHARACTER:AAR
COUNTRY:CHARACTER:DK
and so on...
DECLARE newref REFERENCE TO Environment.Variables.ODList[ODList];//This reference points only to the first value of odlist
WHILE LASTMOVE (newref) DO
IF (DepRef = Environment.Variables.ODList[ODList].AIRPORT_CODE) THEN
SET DomesticFlag = 1;
END IF;
MOVE newref NEXTSIBLING REPEAT TYPE NAME;
END WHILE;


Your post is much easier to read when wrapped in [C O D E] tags.

The PASSTHRU statement would normally be written as something like
Code:

SET Environment.Variables.ODList[] = PASSTHRU('SELECT s.filed1,s.field2 FROM dev1.table AS s');


Then this
Code:

IF (DepRef = Environment.Variables.ODList[ODList].AIRPORT_CODE) THEN


might only ever refer to the first element in the list. Should you not be using 'newref' here?
_________________
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
vickykarumbhu
PostPosted: Tue Jun 09, 2015 5:25 am    Post subject: Reply with quote

Newbie

Joined: 08 Jun 2015
Posts: 6

Yes. I need to traverse to all the elements listed in environment and should check the values. So how could i store all the field1 values into one array from the environment variables. guide me on this
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jun 09, 2015 5:32 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

vickykarumbhu wrote:
So how could i store all the field1 values into one array from the environment variables.


smdavies99 wrote:
Code:
 SET Environment.Variables.ODList[] = PASSTHRU('SELECT s.filed1,s.field2 FROM dev1.table AS s');


vickykarumbhu wrote:
guide me on this


He did.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Array in Database
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.