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 » WMQI - Split string by delimiters

Post new topic  Reply to topic
 WMQI - Split string by delimiters « View previous topic :: View next topic » 
Author Message
emoynihan
PostPosted: Thu Nov 20, 2003 3:02 am    Post subject: WMQI - Split string by delimiters Reply with quote

Newbie

Joined: 20 Nov 2003
Posts: 3

Hi there!
I have an XML element which contains any number of numeric fields each delimited by a comma.
I'm trying to unpack this string and create a new bunch of XML elements for each number, discarding the comma delimiters in the process.
(So, for example, '123,678,351' results in the creation of 3 fields containing Field 1 = 123 Field 2 = 678 and Field 3 = 351).
However I cannot find any command to do this, as you can in most scripting languages....
Any suggestion?

Thanks!!
Back to top
View user's profile Send private message
zpat
PostPosted: Thu Nov 20, 2003 3:56 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

I am not a WMQI message flow developer, but could you not do something like use Reset Content Descriptor to re-parse it as a delimited data type?

Delimited data is one of the supported formats in WMQI 2.1 and above.
Back to top
View user's profile Send private message
kingsley
PostPosted: Thu Nov 20, 2003 6:01 am    Post subject: Reply with quote

Disciple

Joined: 30 Sep 2001
Posts: 175
Location: Hursley

You need to use ESQL.

Otherwise, extract the string and send it through another message flow, which uses Tagged Delimited format which converts to XML.

Then combine the flow to the mainflow. this is a big round way method unless you have off the shelf flow to handle this.
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Thu Nov 20, 2003 6:10 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You can use the Substring and Position ESQL functions to extract each of your elements.

But you are correct, there is no "split" or "strtok" or other such "convert a string into a list of strings, separated at a specified delimiter" function built in.

At least not in 2.1 or earlier.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Missam
PostPosted: Thu Nov 20, 2003 11:27 am    Post subject: Reply with quote

Chevalier

Joined: 16 Oct 2003
Posts: 424

Hi
You can do this by writing loop
Here is the example i'm giving,you can modify this according your needs.

Declare value Character;
Declare Num Integer;
SET value = InputRoot.XML.Number;

Declare pos Integer;
Declare SubVal Character;
Set SubVal = value;
SET pos = Position(',' IN SubVal);

While (pos > 0) DO

Set Num = Substring(SubVal from 1 for (pos-1));

Create LastChild Of OutputRoot.XML.Number DOMAIN 'XML'NAME 'Field';
Set OutputRoot.XML.Number."Field"[LAST] = Num;

Set SubVal = Substring(SubVal From (pos+1));
Set pos = Position(',' IN SubVal);
END WHILE;
Create LastChild Of OutputRoot.XML.Number DOMAIN 'XML'NAME 'Field';
Set OutputRoot.XML.Number."Field"[LAST] = CAST(SubVal AS Integer);

Thanx
Sam
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 » WMQI - Split string by delimiters
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.