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 » Missing index

Post new topic  Reply to topic
 Missing index « View previous topic :: View next topic » 
Author Message
LH33
PostPosted: Sat Aug 30, 2003 7:10 am    Post subject: Missing index Reply with quote

Master

Joined: 21 Nov 2002
Posts: 200

I have a message flow that needs to transform an indexed tag where the index = 2.

In the XML transaction, the tag for index = 1 is not there. In this example, I need to take the input tag <UDF index="2">POLEWORK</UDF> and set the output tag to <UDF index="2">MAINTENANC</UDF>.

Her is my code:

DECLARE UDFS2 CHAR;
SET UDFS2 = THE ( SELECT ITEM R FROM
InputRoot.XML.SyncJob.DataArea.Job.UDFS.UDF[] as R where
R.(XML.Attribute)index = '2');

SET OutputRoot.XML.SyncJob.DataArea.Job.UDFS.UDF[2] =
CASE UDFS2
WHEN 'POLEWORK' THEN 'MAINTENANC'
WHEN 'MTR/LOOP' THEN 'MAINTENANC'
WHEN 'SECDFAULT' THEN 'MAINTENANC'
END;


Here is my input XML:

<SyncJob revision="1.0.0" environment="Test">
<DataArea>
<Job>
<JobNumber>EOM-20030715-0002</JobNumber>
<UDFS>
<UDF index="2">POLEWORK</UDF>
</UDFS>
<WorkCodeUDFS>
<WorkCodeUDF index="77">Y</WorkCodeUDF>
</WorkCodeUDFS>
</Job>
</DataArea>
</SyncJob>

The output that I get is as follows:

<SyncJob revision="1.0.0" environment="Test">
<DataArea>
<Job>
<JobNumber>EOM-20030715-0002</JobNumber>
<UDFS>
<UDF index="2">POLEWORK</UDF>
<UDF>MAINTENANC</UDF>
</UDFS>
<WorkCodeUDFS>
<WorkCodeUDF index="77">Y</WorkCodeUDF>
</WorkCodeUDFS>
</Job>
</DataArea>
</SyncJob>

What I need it to be is:

<SyncJob revision="1.0.0" environment="Test">
<DataArea>
<Job>
<JobNumber>EOM-20030715-0002</JobNumber>
<UDFS>
<UDF index="2">MAINTENANC</UDF>
</UDFS>
<WorkCodeUDFS>
<WorkCodeUDF index="77">Y</WorkCodeUDF>
</WorkCodeUDFS>
</Job>
</DataArea>
</SyncJob>

Can someone help to see what I need to do.

Thanks, Lisa
Back to top
View user's profile Send private message
kirani
PostPosted: Sat Aug 30, 2003 7:19 pm    Post subject: Reply with quote

Jedi Knight

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

You need to select copy entire message in yourcompute node and then use following code to overwrite the value in the output tree
Code:

SET OutputRoot.XML.SyncJob.DataArea.Job.UDFS.UDF =
CASE UDFS2
WHEN 'POLEWORK' THEN 'MAINTENANC'
WHEN 'MTR/LOOP' THEN 'MAINTENANC'
WHEN 'SECDFAULT' THEN 'MAINTENANC'
END;


Now, it will be tricky if you have multiple occurances of <UDF> tags in your message because you would like to update one specific occurance. You may have to find the index first before updating that tag.
_________________
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
LH33
PostPosted: Sun Aug 31, 2003 9:56 am    Post subject: Reply with quote

Master

Joined: 21 Nov 2002
Posts: 200

Kiran,

I had the Copy Entire Message checked and also had the code that you suggested. It appears that since the first index is not present in the XML, that the Message flow thinks the second one is the first. So, I set the tag with index = 1 to MAINTENANC and then gave it an XML.Attribute of index = 2 and it works fine.

Thanks!! Lisa
Back to top
View user's profile Send private message
kirani
PostPosted: Mon Sep 01, 2003 7:53 pm    Post subject: Reply with quote

Jedi Knight

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

The tag <UDF index="2">POLEWORK</UDF> can come before or without <UDF index="1"> tag in your XML. Here, index is just an XML attribute, it's not an index of occurance or repeated XML tag. XML doesn't force these attributes to be numbered in sequential order.
_________________
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 » Missing index
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.