Author |
Message
|
WBI_user |
Posted: Thu Oct 25, 2001 1:35 pm Post subject: |
|
|
Partisan
Joined: 07 Aug 2001 Posts: 386
|
I have successfully generated a CWF message from an XML message with repeating elements.
The number of repeats depends on the number of Elements in the incoming XML message
My output message in MRM looks like
MRM
HEADER
REPEAT_COUNT
ELEMENT (Repeating elements)
My output CWF message is :
header0005ElementElementElementElementElement
where 0005 is the repeat count.
The REPEAT_COUNT is added to the message so that MRM can repeat ELement the number of time equal to the REPEAT_COUNT. But the receiving application cannot handle the added REPEAT COUNT field. It only expect:
header0005ElementElementElementElementElement
Can some one help me on how I can remove the REPEAT_COUNT field.
[ This Message was edited by: Kelvin Yung on 2001-10-25 14:36 ] |
|
Back to top |
|
 |
datchl1 |
Posted: Tue Oct 30, 2001 9:10 am Post subject: |
|
|
Newbie
Joined: 29 Oct 2001 Posts: 1
|
We have had success at running the message through a Reset Content Descriptor Node which specifies a change to the BLOB domain. This is followed by a Compute node with the following statement (assuming your repeat counter is 5 bytes):
SET OutputRoot."BLOB"."BLOB" = SUBSTRING(InputRoot."BLOB"."BLOB" FROM 6);
The output of this compute node then goes to your output node. Works great. |
|
Back to top |
|
 |
WBI_user |
Posted: Tue Oct 30, 2001 8:44 pm Post subject: |
|
|
Partisan
Joined: 07 Aug 2001 Posts: 386
|
Thanks, I did the same thing for my customer. However they don't like the idea of using substring because the "from N for M" in the ESQL is considered as hard coding. If they change the COBOL copy book to move the repeat count field or even if length of any element in the message changes, they have to remember to change the N and M value in the ESQL. |
|
Back to top |
|
 |
swales |
Posted: Thu Nov 15, 2001 11:49 pm Post subject: |
|
|
Newbie
Joined: 14 Nov 2001 Posts: 1
|
You can remove the field by setting it to NULL
SET OutputRoot.Feild.RepeatCountFieldName = NULL |
|
Back to top |
|
 |
sakeme |
Posted: Thu Sep 19, 2002 10:53 pm Post subject: |
|
|
Newbie
Joined: 28 Aug 2002 Posts: 3
|
Swales,
I am trying to implement your suggestion, but unfortunately it did not work. I want to make sure that I am not making a mistake.
i created a mrm messsage with elements,
MyCounter - integer of length 1
Name - string of length 5
Ssn - integer of length 10
and name and ssn fields repeat based on the field value of myCounter.
Till here its looks great.
But i have to generate message which looks,
when MyCounter has value = 3 then the output should be :
NameSsnNameSsnNameSsnNameSsn
my esql at compute node level ( my input message is in xml):
SET OutputRoot.Field.MyCounter = NULL
SET OutputRoot.Field.Name= InputBody.Info.(XML.attribute)Name;
SET OutputRoot.Field.Ssn= InputBody.Info.(XML.attribute)Ssn;
it fails at MyCounter basically CWF parsing probs.
is there any other way ... |
|
Back to top |
|
 |
kirani |
Posted: Fri Sep 20, 2002 7:27 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
sakeme,
Assigning NULL value to MRM element will not remove the element from parsed tree. Either you have to use SUBSTRING function to remove MyCounter from the message (as mentioned by datchl1) or declare another message in which Name and SSN fields repeat fixed number of times.
I see 2 problems in your code,
1. I dodn't see MRM parser name.
2. There is no while loop to assign repeated XML elements to MRM fields.
Your ESQL code to do XML to MRM transformation should be similar to ..
Code: |
-- Write ESQL to Set values in Properties folder
SET OutputRoot.MRM.MyCounter = CARDINALITY(InputBody.Info[]);
DECLARE I INT;
SET I = 1;
WHILE (I <= OutputRoot.MRM.MyCounter) DO
SET OutputRoot.MRM.<repeat_type>[I].Name= InputBody.Info[I].(XML.attribute)Name;
SET OutputRoot.MRM.<repeat_type>[I].Ssn= InputBody.Info[I].(XML.attribute)Ssn;
SET I = I + 1;
END WHILE;
|
After this use RCD node to reset message domain to BLOB.
In another compute node, remove the repeat element using SUBSTRING function. _________________ 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 |
|
 |
|