|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
|
|
Transforming XML structure based on MRM structure |
« View previous topic :: View next topic » |
Author |
Message
|
devita |
Posted: Fri Sep 07, 2001 7:46 am Post subject: |
|
|
Novice
Joined: 19 Jul 2001 Posts: 14
|
I have to pass this XML input message:
<MSG>
<DATA>
<F1>xx</F1>
<F2>yyy</F2>
</DATA>
</MSG>
to a legacy application that uses the COBOL structure:
01 DATA
03 F1 PICX(5)
03 F2 PICX(5).
Then I'd like to transform my input XML in an output XML:
<MSG>
<DATA>xxbbbyyybb</DATA>
</MSG>
where b = blank.
I tried to pass through a MRM message (derived by the COBOL structure) and concatenate the MRM fields, but I can't safe the blanks.
I always produce the output string xxyyy without blanks.
Can somebody help me ?
Thank you. |
|
Back to top |
|
|
CodeCraft |
Posted: Sat Sep 08, 2001 2:21 am Post subject: |
|
|
Disciple
Joined: 05 Sep 2001 Posts: 195
|
The problem here is really with the blanks in the XML, not the transformation to the legacy application.
If you parse a bitstream against the MRM parser, the blanks will only be preserved in the tree if the padding character in the CWF attributes is set to something other than blanks. If you want to do all of this in one flow, you'll need to do something which will cause the message to be serialised and reparsed so that the legacy bitstream is parsed with the spaces preserved.
If you're literally talking about two fields, you could use an RCD to recast the message from MRM to MRM. The RCD should cause the bitstream for the MRM message to be recreated, and then reparsed, thus adding the spaces in the tree.
You can then concatenate the fields when creating the final XML message. You'll obviously need multiple branches in the flow for the handing of each output message type.
If you are talking about DATA contain F1..Fn where 'n' is larger than 2, and containing possible nested data etc, you could reparse MRM message A using MRM message B where B is just one string element whose length is the same as the sum of all element lengths in A.
This is fine for PIC X data, not for other data.
Does this answer the question for you? |
|
Back to top |
|
|
devita |
Posted: Tue Sep 11, 2001 4:24 am Post subject: |
|
|
Novice
Joined: 19 Jul 2001 Posts: 14
|
Hi, thanks for your tip. This approach helps me but I have a last problem: using your idea I have to safe the last blanks, so when I assign the MRM STRING value to XML field I have the value xxxbbyyy (I'd like to have a 10 bytes string xxxbbyyybb).
I resolved this problem using a dummy final char in the MRM structure and using the istruction: OutputRoot.XML.Data = SUBSTRING(InputRoot.MRM.STRING 1 to l-1) where l is the STRING length.
Have you a more elegant solution?
Thanks, Ugo |
|
Back to top |
|
|
|
|
|
|
Page 1 of 1 |
|
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
|
|
|
|