Author |
Message
|
wmqi_2 |
Posted: Sun Jun 02, 2002 3:50 pm Post subject: XML to copybook |
|
|
Novice
Joined: 04 May 2002 Posts: 12
|
i am workin with converting XML to cobol structure.
<mesg><name>AB</name><name>CD</name><name>EF</name></mesg>
Lets say, i know the count of the repeating fields before hand.
I created a mesgSet that has an element - "Name", type String & length 2.
And I set "Repeat Count" as 3.
I tried few things in message flow but did not meet success.
I am looking forward for your tips guyz.
thnX |
|
Back to top |
|
 |
kirani |
Posted: Sun Jun 02, 2002 5:16 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Can you explain more about the problem here? What is the exact error message you are getting? Posting your ESQL would be helpful. _________________ 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 |
|
 |
wmqi_2 |
Posted: Mon Jun 03, 2002 6:12 am Post subject: |
|
|
Novice
Joined: 04 May 2002 Posts: 12
|
<mesg>
<name>AB</name>
<name>CD</name>
<name>EF</name>
</mesg>
The ESQL would be (some kind of looping should be done here on the "name" field for 3 times):
SET OutputRoot.MRM.NAME = InputBody.mesg."name";
I set the repeat count for the element "NAME" as 3 times.
The expected output would look like : ABCDEF |
|
Back to top |
|
 |
kirani |
Posted: Mon Jun 03, 2002 8:14 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
1. Modify values for MessageFormat, MessageType and MessageSet in the following code as per your environment.
Select "Copy Message Headers Only" in a compute node.
DECLARE I INT;
SET I = 1;
WHILE (I<=3) DO
SET OutputRoot.MRM."NAME"[I] = InputBody.mesg."name"[I];
SET I = I + 1;
END WHILE;
SET OutputRoot.Properties.MessageSet = 'D0...';
SET OutputRoot.Properties.MessageDomain = 'MRM';
SET OutputRoot.Properties.MessageFormat = 'CWF';
SET OutputRoot.Properties.MessageType = m_....;
2. Assign this messageSet to the broker and do a broker level deploy. _________________ 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 |
|
 |
wmqi_2 |
Posted: Mon Jun 03, 2002 11:00 am Post subject: |
|
|
Novice
Joined: 04 May 2002 Posts: 12
|
hi kirani
thanks for ur reply....
i did tried what you suggested but i got this error
Invalid indexed assignment to NAME[2].
I did assigned the element properties as "Repeat" & set the count=3.
The length was set as 2.
what am I missing here ? |
|
Back to top |
|
 |
wmqi_2 |
Posted: Mon Jun 03, 2002 6:28 pm Post subject: |
|
|
Novice
Joined: 04 May 2002 Posts: 12
|
I hope some one could help me on this problem ....
Looking forward for your suggestions.. |
|
Back to top |
|
 |
kirani |
Posted: Mon Jun 03, 2002 6:56 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
I will try to test this on my machine and let you know about the results.
In the meantime if someone has already tested this can help. _________________ 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 |
|
 |
kirani |
Posted: Mon Jun 03, 2002 9:05 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
I tried following code on my machine and it worked.
I created a new message set, type and element. In types folder, I had set Repeat to 'Yes' under Connection tab. In CWF tab, I had Set RepeatCountType to Count and RepeatCount to 3.
In compute node I have following ESQL code,
SET OutputRoot.MRM."NAME"[1] = 'AB';
SET OutputRoot.MRM."NAME"[2] = 'CD';
SET OutputRoot.MRM."NAME"[3] = 'EF';
SET OutputRoot.Properties.MessageDomain = 'MRM';
SET OutputRoot.Properties.MessageFormat = 'CWF';
SET OutputRoot.Properties.MessageType = m_..;
SET OutputRoot.Properties.MessageSet = 'D...';
This gives me ABCDEF output message and trace shows me it is is creating repeating NAME element. _________________ 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 |
|
 |
vanessa |
Posted: Thu Jun 06, 2002 6:16 am Post subject: |
|
|
Novice
Joined: 24 Jan 2002 Posts: 22
|
I also tried this solution myself, but it did not work.
Got the same error. I hope same is the case with Kirani too.
Just wonderin if any one has had/used this kind of scenario.
Thannks in adv |
|
Back to top |
|
 |
|