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 » xml to copybook

Post new topic  Reply to topic
 xml to copybook « View previous topic :: View next topic » 
Author Message
aks
PostPosted: Fri Jul 19, 2002 2:15 am    Post subject: xml to copybook Reply with quote

Voyager

Joined: 19 Jul 2002
Posts: 84

I am transforming XML into a COBOL copybook in a compute node.

Would someone please help me with ESQL syntax to map repeating XML elements into MRM fields:

Part of my xml looks like this:
...
<factors>
<factor>blah 2</factor>
<factor>blah 1</factor>
</factors>
...

There can be any number of factor elements, but it must map to a copybook structure that allows a fixed number of fields, in my current copybook, 13. That is

...
100 07 FACTORS
200 09 FACTOR01
300 09 FACTOR02
400 09 FACTOR03
... .....
1000 09 FACTOR13
1100 07 FACTORS

So I want to map the first <factor> to FACTOR01, the 2nd to FACTOR02 and so forth. If there are less than 13 <factor> tags, for example 8, then the remaining 5 MRM fields, FACTOR09 to FACTOR13 just need to be set to blank (''). If there are more than 13 <factor> elements, then the rest get thrown away.


I know I would be able to do this eventually, but since I am new to MQSI and I have a tight deadline, any help would be appreciated

Thanks
Alan
Back to top
View user's profile Send private message
kirani
PostPosted: Fri Jul 19, 2002 8:15 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Alan,

You could first create a default value (space ' ') for elements, FACTOR01...13 in MRM-CWF. Then use some while loop to iterate over input repeating XML elements and based on counter switch to different branches, where you will assign input XML element to output MRM field. For example, if the cunter is 3, you should switch to statement,
SET OutputRoot.MRM."FACTOR03" = InputRoot.XML...factors.factor[CNT];
where CNT = 3.

Alternative to SWITCH statement, you could use EVAL statement to dynamically generate MRM FIELD names (FACTOR01....FACTOR13).

Hope this helps.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
Miriam Kaestner
PostPosted: Thu Jul 25, 2002 3:04 am    Post subject: Reply with quote

Centurion

Joined: 26 Jun 2001
Posts: 103
Location: IBM IT Education Services, Germany

Instead of the EVALUATE statement which performs poorly, you could also use dynamic field name notation {}, e.g.
SET OutputRoot.MRM.{'FACTOR'||CAST(CNT AS CHAR)} = InputRoot.XML...factors.factor[CNT];
Back to top
View user's profile Send private message Send e-mail
kirani
PostPosted: Thu Jul 25, 2002 11:40 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

didn't know about {...} in Fieldnames. I guess, this was introduced in CSD2.
Thanks for the information Miriam!
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » xml to copybook
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.