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 IndexWebSphere Message Broker (ACE) SupportTransforming XML to MRM with optional elements

Post new topicReply to topic Goto page 1, 2  Next
Transforming XML to MRM with optional elements View previous topic :: View next topic
Author Message
adkessell
PostPosted: Tue May 06, 2003 4:55 pm Post subject: Transforming XML to MRM with optional elements Reply with quote

Novice

Joined: 29 Aug 2001
Posts: 10

I have a XML message that has elements that are optional, and I want to transform the XML to a MRM structure.

Is there a simple way to make elements optional in MRM using the CWF? So that the option elements in the XML can be left out of the MRM structure on outbound.

XML (B is Optional)
<Msg><A>ccc</A><B>vvvv</B><C>zzzzz</C></Msg>

MRM
A1 = A
B1 = B (Optional)
C1 = C

So if B is missing from the XML I want B1 not to show up in the output MRM message.
Back to top
View user's profile Send private message
kirani
PostPosted: Tue May 06, 2003 8:38 pm Post subject: Reply with quote

Jedi Knight

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

As per Working With Messages manual ...
Quote:

When you have created the basic structure of a message using the Control Center, you must consider what level of complexity needs to be added to the model:
. Can an element repeat? Is so how many times can it repeat? The default is that an element does not repeat, that is, there is one and only one instance.
. Is an element optional or mandatory? The default is that an element is
mandatory.

You can modify these defaults for documentation purposes by updating the
properties on the Connection pane for compound types and elements (see “Type” on page 49 and “Element” on page 45). However, these properties, and the conditions they define, are not enforced by the broker.


You could define 2 different message formats, one with B1 and another without B1.
_________________
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
adkessell
PostPosted: Wed May 07, 2003 3:32 am Post subject: Reply with quote

Novice

Joined: 29 Aug 2001
Posts: 10

Yes I have thought of that, but one thing I forgot to mention is that the XML and MRM message are a lot more complex. There is actually 12 elements that can be optional in a random way.

So there isn't a sit sequence that they will be there in which makes it hard to setup different MRMs to cover the different combinations that could arise.

Thanks
Anthony
Back to top
View user's profile Send private message
Miriam Kaestner
PostPosted: Wed May 07, 2003 10:28 am Post subject: Reply with quote

Centurion

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

For CWF physical format (and TDS with fixed length), it is not possible to leave out any element. You may define an element as optional, but then you must define a default value for it. Otherwise the parser can't determine which element is actually missing.
Back to top
View user's profile Send private message Send e-mail
lung
PostPosted: Wed May 07, 2003 11:23 pm Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

I don't get it. What does defining it to be 'optional' actually do, when it will still exist in the final output?
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
drajib
PostPosted: Thu May 08, 2003 4:29 am Post subject: Reply with quote

Apprentice

Joined: 25 Mar 2003
Posts: 42
Location: India

For a Tag Delimited Variable Length message, I have been able to make the fields optional (Min Occurs in Connection tab = 0). However I could not solve the following so far

Message Structure
Quote:
MSG (Tag Delimited Variable Length - <LF>)
- HDR (Mandatory 1-1, Delimiter - <LF>)
- DTL (Optional 0-n, Repeating element delimiter - <LF>)
- FTR (Mandatory 1-1, Delimiter - <LF>)


The output data is coming out as
Quote:
Fields for HDR <LF>
<LF>
Fields for FTR <LF>


Could you please throw some light on how to make it
Quote:
Fields for HDR <LF>
Fields for FTR <LF>

i.e. The Repeating element delimiter for DTL should not be present.

Best regards,
Back to top
View user's profile Send private message
lung
PostPosted: Mon Jan 16, 2012 7:13 pm Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

Hi,

Any workaround for the problem above?
I found myself trying to achieve the same thing.

Am actually looking at CWF with Min Occurs = 0, and Max Occurs = 1, but the Min Occurs doesn't seem to actually do anything, as when I don't map anything, it will still appear as the default values with the assigned length.

How do I make the field to totally disappear without resorting to TDS?

Thanks!
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
fjb_saper
PostPosted: Mon Jan 16, 2012 8:42 pm Post subject: Reply with quote

Grand High Poobah

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

lung wrote:
Hi,

Any workaround for the problem above?
I found myself trying to achieve the same thing.

Am actually looking at CWF with Min Occurs = 0, and Max Occurs = 1, but the Min Occurs doesn't seem to actually do anything, as when I don't map anything, it will still appear as the default values with the assigned length.

How do I make the field to totally disappear without resorting to TDS?

Thanks!


Look at how the COBOL occurs depending on is modeled...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
lung
PostPosted: Mon Jan 16, 2012 10:15 pm Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

Yea, I am trying to get the actual copybook from the receiving program, but until then I need to figure this out on my own...

Basically, input data is something like:
<XML>
<A>ABC</A>
<B></B>
<C>GHI</C>
</XML>

Assuming all fields are 3 bytes, in CWF, I need to make this as:
ABCGHI

Instead of:
ABC GHI

I need WMB to automatically make field B occurs = 0 when there is zero length and/or no mapping involved...
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
kimbert
PostPosted: Tue Jan 17, 2012 2:57 am Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
How do I make the field to totally disappear without resorting to TDS?
Why do you want to avoid TDS? If CWF cannot do what you need, then you should use TDS.
Quote:
the Min Occurs doesn't seem to actually do anything, as when I don't map anything, it will still appear as the default values with the assigned length.
I assure you that it does a lot. The minOccurs setting is a property of the *logical* format. It describes what is in the message tree. There may be very good reasons why a field that is missing from the tree needs to appear in the data ( e.g. in order to make the data parseable by the downstream application )
I have no idea whether this applies in your case - you have given very little information about the physical layout of your data format. As a start, you could tell us whether this optional field is tagged.
Back to top
View user's profile Send private message
lung
PostPosted: Tue Jan 17, 2012 3:19 am Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

Hi,

The reason why I prefer to use CWF is because I want to keep track of the max length of the field, this has often come up as a troubleshooting issue in the past when I used TDS.

As per my given example, that is the physical layout I require.
There is no additional tagging on the optional field.

Basically I have 3 fields (A, B, C), and assuming field B is optional, I need a way to dynamically set its min & max occurrence to 0 so that it will not appear in the message at all (not even with its default value).

As per the previous example, what I need is:
ABCGHI

Instead of:
ABC___GHI
(Where _ = space, the default value)

Hope this gets my question across clearer... Thanks!
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
kimbert
PostPosted: Tue Jan 17, 2012 3:41 am Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Your data format is very unusual - optional fields are almost always tagged or else there is a field that gives the number of occurrences. Please explain how the receiver will parse this message. Will they look at the length of the message? Or maybe B and C are easily distinguished because their 'lexical space' is completely different?
Quote:
Basically I have 3 fields (A, B, C), and assuming field B is optional, I need a way to dynamically set its min & max occurrence to 0 so that it will not appear in the message at all (not even with its default value).
Your requirement is to be able to omit B from the output message. The solution is *not* to adjust minOccurs and maxOccurs - that is impossible anyway. I suggest that you try setting 'Data Element Separation' to 'Use Data Pattern'. That will switch off the defaulting, anyway.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jan 17, 2012 5:44 am Post subject: Reply with quote

Grand High Poobah

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

lung wrote:
As per the previous example, what I need is:
ABCGHI

Instead of:
ABC___GHI
(Where _ = space, the default value)


How does the downstream application (which consumes this) determine that "GHI" in "ABCGHI" is the third element rather than the second?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
lung
PostPosted: Tue Jan 17, 2012 5:47 pm Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

Hi,

It is actually delimited. I am omitting that info because what I want to do is to achieve this in CWF as mentioned earlier.

So the output will actually be:
ABC<LF><LF>GHI<LF>
(where <LF> is the delimiter)

I am actually defining the <LF> delimiters as additional fields.

kimbert,

This is actually related to the email I sent to you yesterday.

I cannot use TDS because there is the problem where a fixed length complex type will always have an additional FD when followed right after with a variable length element.

Is there a way to use TDS but in fixed length, and somehow tell WMB to omit optional fields from being generated?
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
cociu_2012
PostPosted: Wed Jan 18, 2012 12:19 am Post subject: Re: Transforming XML to MRM with optional elements Reply with quote

Acolyte

Joined: 06 Jan 2012
Posts: 72

adkessell wrote:
I have a XML message that has elements that are optional, and I want to transform the XML to a MRM structure.


If you're flexible and can change the parser, I'll recommend to use XMLNSC.
This parser is more simple ( Note:be careful, you'll have to read and understand the differences MRM vs XMLNSC). You can make the output as you want using this parser. Applies only for XML.

http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fbb45000_.htm
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum IndexWebSphere Message Broker (ACE) SupportTransforming XML to MRM with optional elements
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.