Author |
Message
|
wmqiadmin |
Posted: Fri Mar 10, 2006 6:44 am Post subject: Multiple copy book defination in one Message Defination file |
|
|
 Disciple
Joined: 19 Jun 2005 Posts: 163 Location: epping UK
|
Hi Every buddy,
Here is the situation:
We have a xml msg which has 1 heaher and 9 cobl copy book messages.
<header> </header>
<body>
<cpy1>
<cpy2>
---
</body>
now i have to parse them and create one message out of it. i am making different messages_types in one Message defination file and planning to create message element one by one usinng compute node & RCD node. Working on V6 win2003.
Q1. Can i make 1 message defination file using multiple copy book, or can i import elemnts from other message defination file to the current message defination file. Most of the elemnts are same.
Q2. What is the best oprtion for this kind of message. Also message will not be big and the cpy1 cp2...cpy9 are variables e.g. any of the cyp book can come either 1 2 3 8 or 4 5 6 9
Thanks in advance. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Mar 10, 2006 7:11 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
now i have to parse them and create one message out of it |
Are you saying that
a) you want to create one XML output message from nine CWF input messages or
b) you will receive a CWF input message containing ( up to ) nine different parts, and you want to construct an output XML message from it.
Quote: |
Can i make 1 message defination file using multiple copy book |
No. Create a message set project, add a CWF physical format, and create 9 different message definition files using the COBOL importer.
Then create another message definition file for your XML wrapper message, and include ( not import ) the other nine message definition files.
Quote: |
cpy1 cp2...cpy9 are variables e.g. any of the cyp book can come either 1 2 3 8 or 4 5 6 9 |
Not quite sure what you mean. Are you saying that any of the 9 COBOL records might be missing from the CWF input message? ( assuming option b) above). If so, how are the records identified in the input bitstream (presumably there's a count field or tag for each one)? |
|
Back to top |
|
 |
wmqiadmin |
Posted: Fri Mar 10, 2006 7:26 am Post subject: |
|
|
 Disciple
Joined: 19 Jun 2005 Posts: 163 Location: epping UK
|
Quote: |
you will receive a CWF input message containing ( up to ) nine different parts, and you want to construct an output XML message from it.
|
Yes we'll recieve up to 9 different CWF messages in xml body as a whole body msg, and any of the 9 cpy msg can be missing. They have unique tags numbers to identify them. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Mar 10, 2006 8:38 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
we'll recieve up to 9 different CWF messages in xml body as a whole body msg, |
Now I understand. So presumably the CWF data is encoded as either base64 or hexBinary ( or else your CWF messages only contain character data).
Quote: |
and any of the 9 cpy msg can be missing |
That's no problem - presumably there's an XML tag around each CWF message, so it will identify the message type for you.
Quote: |
now i have to parse them and create one message out of it |
What does the output message have to look like? Are you trying to output an XML message in which all the CWF data has been converted to XML? |
|
Back to top |
|
 |
mqsiadm |
Posted: Fri Mar 10, 2006 8:43 am Post subject: |
|
|
Novice
Joined: 05 Mar 2006 Posts: 12
|
the message structure is
<header> </header>
<body>
<cpy1> real copybook as element data </cpy1>
<cpy2> real copybook as element data </cpy2>
---
---
---
<cpy9> real copybook as element data </cpy9>
</body>
these 9 elements above(cpy1 through cpy9) are dyanamic which means they may or may not come.
now i have to take each cpy element and unwrap any XML wrapping and convert only the data from CWF to XML for all 1 through 9 elements.
as you said i have created one message set for above stated XML.
then i have created 9 differnt message definition files using the COBOL importer.
now i have a question.
what is the best way to parse and convert all these to 1 XML output message.
inshort how should i convert each cpybook from input message to one output XML.
thanks kimbert for your previous input and pl advice for this. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Mar 10, 2006 9:09 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Code: |
Parse the input XML message using the XMLNSC parser
Create the root of the output message and add the header and (empty) body
For each child of InputBody.body
Use CREATE FIELD...PARSE to parse it as the last child of OutputRoot.Body.body |
If you've never use CREATE FIELD...PARSE, it's all described in the product docs and on various posts on this forum ( use the Search button to find them )
You didn't answer my question about binary data - I assume the incoming CWF messages contain fixed-length text fields. |
|
Back to top |
|
 |
wmqiadmin |
Posted: Fri Mar 10, 2006 9:19 am Post subject: |
|
|
 Disciple
Joined: 19 Jun 2005 Posts: 163 Location: epping UK
|
Quote: |
Now I understand. So presumably the CWF data is encoded as either base64 or hexBinary ( or else your CWF messages only contain character data). |
Its an character data.
Quote: |
That's no problem - presumably there's an XML tag around each CWF message, so it will identify the message type for you.
|
Yes and also the msg have attributes to distinguish the data.
Quote: |
What does the output message have to look like? Are you trying to output an XML message in which all the CWF data has been converted to XML? |
The msg has to be parsed completely unwrap the cpy data, create a new aggregate msg from all of the CWF data fields(cpy1-cpy9), the outgoing msg has to be in XML format with selected fileds from the aggregate msg. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Mar 10, 2006 9:55 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So, basically, you have to copy certain XML Elements from an input message and then concatenate the contents of several XML elements into a single element.
If the CWF data is all character data, then leave it alone and don't even bother parsing it. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wmqiadmin |
Posted: Fri Mar 10, 2006 10:51 am Post subject: |
|
|
 Disciple
Joined: 19 Jun 2005 Posts: 163 Location: epping UK
|
Is there any chance that i can import only elements from the cobol file importer and then create messages manually. Because now i have problem that some of the fields are common so the toolkit is giving error " duplicate xml element name for global elements in single msg set project"
And most of the elements are common in the CWF input message. |
|
Back to top |
|
 |
mqsiadm |
Posted: Fri Mar 10, 2006 11:55 am Post subject: |
|
|
Novice
Joined: 05 Mar 2006 Posts: 12
|
Thanks for your help guys, I guess I am not able to put my question in correct way,This is what I want
Input message:
<header> this is a header</header>
<body>
<cpy1> AAAA AAA AAAAAA AAAA AAA AAA </cpy1>
<cpy2> BBB B BBBB BBB BBBBBBB BBBB B </cpy2>
---
---
---
<cpy9> 9999 9999 9999 9 9 9 9 99 9 99 9 99 </cpy9>
</body>
now I want ouput message as:
<header> this is a header</header>
<body>
<cpy1>
<e1>AAAA </e1>
<e2>AAA</e2>
<e3>AAAAAA </e3>
<e4>AAAA </e4>
<e5>AAA </e5>
<e6>AAA </e6>
</cpy1>
<cpy2>
<e21>BBB </e21>
<e22>B </e22>
<e23>BBBB </e23>
<e24>BBB </e24>
<e25>BBBBBBB</e25>
<e26>BBBB </e26>
<e27>B </e27>
</cpy2>
---
---
---
</body>
please advice what is the correct way to program this? |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Mar 10, 2006 12:16 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Ah!
Okay.
Then, you need to build a model of each CWF entry. You will need to add an XML Physical layer to each model.
You then have to extract the contents of each XML field, and use CREATE FIELD... PARSE to convert that to a logical tree and insert it into the right place in OutputRoot.
Then, because you have the Physical Format, when you output the data it will be XML.
But you will also need, I think, to model your Input XML, so that you are working with InputRoot.MRM instead of InputRoot.XMLNS or etc. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|