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 » Repeating XML structures

Post new topic  Reply to topic
 Repeating XML structures « View previous topic :: View next topic » 
Author Message
WBI_user
PostPosted: Sun Aug 26, 2001 8:05 am    Post subject: Reply with quote

Partisan

Joined: 07 Aug 2001
Posts: 386

The content of my previous post was corrupted because I think I forgot to disable HTML.
Here is the question once more.

I have 2 questions that I need help on:

1. When I use the Set OutputRoot.XML.. statement in the compute node, if the structure already exist, the content of the element will be updated.

I have the requirement to produce XML output containing repating structure :
<message>
<customer1>
<data1>wwwwww</data1>
<time>xxxxxx</time>
<data2>yyyyyyyyy</data2>
<data1>wwwwww</data1>
<time>xxxxxx</time>
<data2>yyyyyyyyy</data2>
:
<data1>wwwwww</data1>
<time>xxxxxx</time>
<data2>yyyyyyyyy</data2>
In the output only the data of the last repeating set is shown.

How should I code the Set OutputRoot.. statement to handle this.

2.Can I use variable in the SET OutputRoot.XML.. Statement ?

I also have a need to produce the XML output like this :
<message>
<data1>xxxxxxxxxxxxxx</data1>
<data2>yyyyyyyyyyyyyy</data2>
:
<datan>zzzzzzzzzzzzzzzz</datan>
Where n can only be determined by other logics inside the message.

If I can use a variable in the SET OutputRoot statment, i can say
SET OutputRoot.XML.message.'variable' =

with variable = datan ;as I detrermine the value of n using other logics inside the compute node.

But the output becomes
<message><variable> not the substituted valuse of variable.

Can someone help ?
Back to top
View user's profile Send private message
kolban
PostPosted: Sun Aug 26, 2001 2:18 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

I am a little confused by the question but I think I get the jist.

It sounds like you are trying to expand a tree within a compute node. This is trivially do-able if the new elements in the tree did not previously exist and don't have the same names as the elements you are trying to add. If you wish to expand a tree with elements of the same name, I believe that you can NOT copy the tree with

SET OutputRoot.XML = InputRoot.XML;

and then simply try and add ...

I think you must copy the elements one by one and add that way:

for example:

WHILE (I<COUNT)
DO
SET OutputRoot.XML.A.B[i] = InputRoot.XML.A.B[i];
SET I=I+1;
DONE
SET OutputRoot.XML.A.B[i] = 'new value';



[ This Message was edited by: kolban on 2001-08-26 15:20 ]
Back to top
View user's profile Send private message
WBI_user
PostPosted: Sun Aug 26, 2001 7:31 pm    Post subject: Reply with quote

Partisan

Joined: 07 Aug 2001
Posts: 386

Thanks for the quick response. Let me explain the question (question 1) again.
I am doing a POC for an Insurance ompany.
For an automobole policy there may be a number of drivers and a number of cars.
The input I got is one big message containing all the information. For example Policy#,driver1,driver2,driver3...car1,car2,car3....,claim1,claim2.... and so on. The number of drivers can go from 1 to many, number of cars can also go from 1 to many. Claims can be zero to many.
What I need to produce is, using the content of this big message:
<policy>policy#
<driver>driver1</driver>
<car>car1</car>
<claim>claim1 or null</claim>
<driver>driver2</driver>
<car>car2</car>
<claim>claim2 or null</claim>
:
<driver>driverN</driver>
<car>carN</car>
<claim>claimN or null</claim>
</policy>

I can use
SET OutputRoot.XML.policy.driver = substring(InputRoot from x for y)
SET OutputRoot.XML.policy.car = substring(InputRoot from a for b)
SET OutputRoot.XML.policy.claim =
substring(InputRoot from d for e)
for the first driver. But because the subsequent driver ,car and claim uses the same tag name, it will just overlay on top of the previous one because path and element already exist (If I understand correctly).

I'll experiment with your suggestion about creating it line by line.

Please update if you have any other suggestion.

The rquirement lead to my second question is again from the same big input string I have to create XML output like:
<policy>policy#
<car1>info of first car</car1>
<car2>info of 2nd car</car2>
:
<carN>info of Nth car</carN>
</policy>

I don't know how many cars are there until I have the message in the compute node. I was hoping that I can use a variable which I can update according as I search through the big message for car information. For example: Variable can be car1 to carN.
If I am allowed to use variable in the SET OutputRoot statement, I can say
SET OutputRoot.XML.policy.variable = .....

But what I got is:
<policy>
<variable>xxxxxx</variable>
</policy>

Any suggestion on this one ?
Back to top
View user's profile Send private message
ext01722
PostPosted: Tue Aug 28, 2001 6:01 am    Post subject: Reply with quote

Newbie

Joined: 25 Jun 2001
Posts: 7
Location: Spain

Hi,
I have had similar problems. But, first of all I have a question:
Is your incoming message defined in the MRM?
Back to top
View user's profile Send private message Send e-mail
kolban
PostPosted: Tue Aug 28, 2001 5:10 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

As we start to use the forum for MQSI message flow kinds of questions, I am thinking that it would be HIGHLY useful to describe the input message layout and the required message layout (or needed fields). Reading ESQL doesn't uncover the underlying requirement. Can you describe, using psuedo data structures, the format of the input message and the mapping to the output message?
Back to top
View user's profile Send private message
WBI_user
PostPosted: Tue Aug 28, 2001 6:56 pm    Post subject: Reply with quote

Partisan

Joined: 07 Aug 2001
Posts: 386

I am still trying to define the message to MRM. The input is a very simple XML message with a begin tag and an end tag.
<message> big message up to 3K </message>.
The challenge of defining this bid message to MRM is it contains miultiple structures which may repeat or may not even exist.
The general layout is (in fix order)
Header section,Policy section,driver section,vehicle section,claim section.
There is always only one header section and one policy section. The driver section may contain one to many driver records. The vehicle section may contain one to many vehicle records. The claim section may not exist. If it does, it may contain one to many claim records. All data are described by their own cobol copy book which I can import to MRM with no problem.
In the driver record, there may be one to many conviction records. There is also one good thing about this mess is all records inside each section are in 'key/length/data' format which allow me to pick up all the field by using substring function. I almost temped to do that after spending hours trying to get the message defined to MRM.

So at a high level , the message is like :
Header......policy.......driver..convict..convict.....driver...convict...driver...Vehicle...vehicle...Vehicle....Claim...claim...

The XML output requirement is :
<header>... header fields...</header>
<Policy>
<field>....POlicy fields... </field>
<driver>...driver fields....</driver>
<convict>...conviction fields..</convict>
:
<driver>...driver fields....</driver>
<convict>...conviction fields..</convict>
<Vehicle>...Vichicle fileds....</vehicle>
:
<Vehicle>...Vichicle fileds....</vehicle>
<Claim>.....claim fields.......</claim>
:
<Claim>.....claim fields.......</claim>
</policy>

Claim & convict, may or may not exist.


It nmay be easier if I can handle this big one a portion at a time with multiple compute node.For example compute1 willl generate the XML for the header section, compute2 will do the policy section, compute3 will do the repeating driver section and so on. But Idon;t know how to tag these multiple output together to form the big XML my customer wants.

Can some one help me with these questions:
1. I know MRM can handle repeating records if I define the record count infront of the repeating structure. Will it work if the record count is zero ?
2. How can I concatenate XML output from multiple comoute node together ?
For example
compute1 output <a>xx</a><b>yy</b><c>zz</c>
compute2 output <e>jj</e><f>* please do not use *</f><g>ll</g>
Final output:
<a>xx</a><b>yy</b><c>zz</c><e>jj</e><f>* please do not use *</f><g>ll</g>

Any other suggestion will be greatly apprciated.

[ This Message was edited by: Kelvin Yung on 2001-08-28 20:12 ]
Back to top
View user's profile Send private message
kolban
PostPosted: Tue Aug 28, 2001 7:09 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

I have always found that the current MRM is only good for data structures that can be described by a COBOL working storage layout or a C structure. Anything further such as taged or complex variable, MRM becomes a hindrance than a benefit. I would strongly suggest evaluating the use of the MQSI V2.0.2 New Era of Network parsers that are well supported in the product. These are surprising flexible and can describe almost any data format. In addition, once parsed, you have the complete tree available to you in compute nodes etc etc. These parsers can seem quite daunting at first but practice and perseverance pays of handsomely.

For your question on combining multiple formats.... consider the TREEASIS parser available for download at IBM's SupportPac website.
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 » Repeating XML structures
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.