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 » CONCATENATE MULTIPLE ROWS into a SINGLE VARIABLE

Post new topic  Reply to topic
 CONCATENATE MULTIPLE ROWS into a SINGLE VARIABLE « View previous topic :: View next topic » 
Author Message
tigerstone
PostPosted: Thu Feb 06, 2014 11:08 am    Post subject: CONCATENATE MULTIPLE ROWS into a SINGLE VARIABLE Reply with quote

Novice

Joined: 06 Feb 2014
Posts: 20

Environment tree consists of multiple quantities containing a value

Environment
Variable
Data
Data
Data
Data
.
.
.
Data


How can I concatenate all Data entries into a single variable ???
i.e;
Environment.Variable.ConcatenatedData = CONCAT(Environment.Variable.Data[1] : Environment.Variable.Data[n] )
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Feb 06, 2014 11:33 am    Post subject: Re: CONCATENATE MULTIPLE ROWS into a SINGLE VARIABLE Reply with quote

Grand High Poobah

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

tigerstone wrote:
How can I concatenate all Data entries into a single variable ???


With looping code similar to that which you've posted. Note that using a reference will perform much better than using an index as your sample code displays.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
codemonkey85
PostPosted: Thu Feb 06, 2014 4:04 pm    Post subject: Reply with quote

Novice

Joined: 06 Feb 2014
Posts: 11
Location: UK

Just as Vitor says, create a reference e.g.

Code:
DECLARE envDataRef REFERENCE TO Environment.Variable.Data;

WHILE LASTMOVE(envDataRef) DO

SET Environment.Variable.ConcatenatedData = COALESCE(Environment.Variable.ConcatenatedData, '') || envDataRef;

MOVE envDataRef NEXTSIBLING REPEAT NAME;

END WHILE;


Or something similar...
_________________
"I don't know if you heard but...I did over 1000"
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Feb 06, 2014 6:23 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20700
Location: LI,NY

And the reason for doing this the hard way would be?
Why not set a parser on the environment tree and use ASBITSTREAM?

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » CONCATENATE MULTIPLE ROWS into a SINGLE VARIABLE
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.