Author |
Message
|
ovasquez |
Posted: Thu Sep 24, 2009 5:59 pm Post subject: Null for CWF format and Remove Tag XML |
|
|
 Centurion
Joined: 09 Dec 2005 Posts: 141 Location: Lima, Peru
|
Environment:
-WinXP SP2
-WMB 6.1.0.4
My Flow
InputMQ-->Trace1--->Compute1--->Trace2--->OutputMQ
I create 1 message definition file:
mdf1-> have definition for MRM(CWF) message:
campo1 length(1)
campo2 length(3)
campo3 length(1)
and change properties for campo2
Representation of null value
Encoding null=NullLiteralFill
Encoding null Value=SPACE
I send for example this message:"A X"
In InputMQ:
Recive message and parsing MRM, CWF
In Compute1:
Code: |
...
--Transformation to XMLSNC
SET OutputRoot.XMLNSC.XML.campo2=InputRoot.MRM.Campo2;
... |
Traces:
i view in Trace1: Campo2 is NULL..is OK.
(0x01000021:Name+):MRM = ( ['mrm' : 0xa05be10]
(0x0300000B:NameValue+):Campo1 = 'A' (CHARACTER)
(0x0300000B:NameValue+):Campo2 = NULL
(0x0300000B:NameValue+):Campo3 = ' X' (CHARACTER)
)
i view in Trace2: ....Campo2 is NULL
(0x01000000:Folder):XMLNSC = ( ['xmlnsc' : 0x2d7b4c0]
(0x01000000:Folder):XML = (
(0x03000000:PCDataField):campo1 = 'A' (CHARACTER)
(0x03000000:PCDataField):campo2 = NULL
(0x03000000:PCDataField):campo3 = ' X' (CHARACTER)
)
)
And in output message is ..... Tag <campo2> is in response...why?
<XML>
<campo1>A</campo1>
<campo2></campo2>
<campo3>X</campo3>
</XML>
But if i change Campute1 for:
Code: |
...
SET OutputRoot.XMLNSC.XML.campo2=NULLIF(InputRoot.MRM.Campo2,NULL);
... |
So output is
<XML>
<campo1>A</campo1>
<campo3>X</campo3>
</XML>
What happend with NULL...?
Thanks. _________________ Oscar Vásquez Flores |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Sep 24, 2009 7:56 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
because you have 2 cases:
1) is equivalent to
SET .....campo2 VALUE = NULL; -- campo2 is a tag in the output
2) is
SET ....campo2 = NULL; -- campo2 tag is not in the output.
Working as designed.
By changing the representation of null value in the XML representation of the message set you might even get the following or something like it:
<campo2 xsi:nil=true xmlns:xsi=[replace here with xsi namespace definition]></campo2>
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Fri Sep 25, 2009 2:05 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
If you had taken a user trace, it would have told you exactly what was happening. Why don't you try it now, and look at the difference between the two cases? |
|
Back to top |
|
 |
ovasquez |
Posted: Fri Sep 25, 2009 6:44 am Post subject: |
|
|
 Centurion
Joined: 09 Dec 2005 Posts: 141 Location: Lima, Peru
|
kimbert wrote: |
If you had taken a user trace, it would have told you exactly what was happening. Why don't you try it now, and look at the difference between the two cases? |
Yes,
case 1)
Trace 2:
(0x01000000:Folder):XMLNSC = ( ['xmlnsc' : 0x2d7b4c0]
(0x01000000:Folder):XML = (
(0x03000000:PCDataField):campo1 = 'A' (CHARACTER)
(0x03000000:PCDataField):campo2 = NULL
(0x03000000:PCDataField):campo3 = ' X' (CHARACTER)
)
)
case 2)
Trace 2:
(0x01000000:Folder):XMLNSC = ( ['xmlnsc' : 0x2d79d08]
(0x01000000:Folder):XML = (
(0x03000000:PCDataField):campo1 = 'A' (CHARACTER)
(0x03000000:PCDataField):campo3 = ' ' (CHARACTER)
)
) _________________ Oscar Vásquez Flores |
|
Back to top |
|
 |
ovasquez |
Posted: Fri Sep 25, 2009 6:53 am Post subject: |
|
|
 Centurion
Joined: 09 Dec 2005 Posts: 141 Location: Lima, Peru
|
fjb_saper wrote: |
because you have 2 cases:
1) is equivalent to
SET .....campo2 VALUE = NULL; -- campo2 is a tag in the output
2) is
SET ....campo2 = NULL; -- campo2 tag is not in the output.
Working as designed.
|
i underestand...but i like don't display TAG empty in output....<campo2></campo2>..not display...
Only option is: ¿?
Use NULLIF or
IF InputRoot.MRM.Campo2 IS NOT NULL THEN
SET OutputRoot.XMLNSC.XML.campo2=InputRoot.MRM.Campo2;
END IF;
I have 220 fields...
so one a one is necesary validate for NULL
Is there other alternative?
Thanks. _________________ Oscar Vásquez Flores |
|
Back to top |
|
 |
kimbert |
Posted: Fri Sep 25, 2009 6:56 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
That was Trace node output, not a user trace. You need to use mqsichangetrace, mqsireadlog, mqsiformatlog and view the resulting text file. There are examples posted in this forum. |
|
Back to top |
|
 |
ovasquez |
Posted: Fri Sep 25, 2009 7:25 am Post subject: |
|
|
 Centurion
Joined: 09 Dec 2005 Posts: 141 Location: Lima, Peru
|
kimbert wrote: |
That was Trace node output, not a user trace. You need to use mqsichangetrace, mqsireadlog, mqsiformatlog and view the resulting text file. There are examples posted in this forum. |
Ok
Case1)
Code: |
[b]. . .[/b]
- <UserTrace timestamp="2009-09-25 15:12:01.215736" thread="2096" function="SqlAssignment::execute" type="ComIbmComputeNode" name="MF_Posicional#FCMComposite_1_3" label="MF_Posicional.Compute" text="'Executing statement at (&1, &2)'" catalog="BIPv610" number="2537" file="F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlAssignment.cpp" line="115">
<Insert type="string">'.MF_Posicional_Compute.Main'</Insert>
<Insert type="string">'11.3'</Insert>
<Insert type="string">'SET OutputRoot.XMLNSC.XML.campo2 = InputRoot.MRM.Campo2;'</Insert>
<Insert type="string">MF_Posicional.Compute</Insert>
</UserTrace>
- <UserTrace timestamp="2009-09-25 15:12:01.215760" thread="2096" function="SqlFieldReference::evaluate" type="ComIbmComputeNode" name="MF_Posicional#FCMComposite_1_3" label="MF_Posicional.Compute" text="'Evaluation result '" catalog="BIPv610" number="2539" file="F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlFieldRef.cpp" line="2559">
<Insert type="string">'.MF_Posicional_Compute.Main'</Insert>
<Insert type="string">'11.36'</Insert>
<Insert type="string">'InputRoot.MRM.Campo2'</Insert>
[b]<Insert type="string">'ROW... Root Element Type=50331659 NameSpace='' Name='Campo2' Value=NULL'</Insert>
<Insert type="string">'InputRoot.MRM.Campo2'</Insert> [/b] <Insert type="string">MF_Posicional.Compute</Insert>
</UserTrace>
- <UserTrace timestamp="2009-09-25 15:12:01.215855" thread="2096" function="SqlCursorEvalResult::assign()" type="ComIbmComputeNode" name="MF_Posicional#FCMComposite_1_3" label="MF_Posicional.Compute" text="'performing tree copy of &1 to &2'" catalog="BIPv610" number="2568" file="F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlAssignment.cpp" line="769">
<Insert type="string">'InputRoot.MRM.Campo2'</Insert>
<Insert type="string">'OutputRoot.XMLNSC.XML.campo2'</Insert>
<Insert type="string">MF_Posicional.Compute</Insert>
</UserTrace>
[b]. . .[/b]
|
Case2)
Code: |
- <UserTrace timestamp="2009-09-25 15:21:54.741287" thread="1736" function="SqlAssignment::execute" type="ComIbmComputeNode" name="MF_Posicional#FCMComposite_1_3" label="MF_Posicional.Compute" text="'Executing statement at (&1, &2)'" catalog="BIPv610" number="2537" file="F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlAssignment.cpp" line="115">
<Insert type="string">'.MF_Posicional_Compute.Main'</Insert>
<Insert type="string">'10.3'</Insert>
<Insert type="string">'SET OutputRoot.XMLNSC.XML.campo2 = NULLIF(InputRoot.MRM.Campo2, NULL);'</Insert>
<Insert type="string">MF_Posicional.Compute</Insert>
</UserTrace>
- <UserTrace timestamp="2009-09-25 15:21:54.741352" thread="1736" function="SqlFieldReference::evaluate" type="ComIbmComputeNode" name="MF_Posicional#FCMComposite_1_3" label="MF_Posicional.Compute" text="'Evaluation result '" catalog="BIPv610" number="2539" file="F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlFieldRef.cpp" line="2779">
<Insert type="string">'.MF_Posicional_Compute.Main'</Insert>
<Insert type="string">'10.43'</Insert>
<Insert type="string">'InputRoot.MRM.Campo2'</Insert>
<Insert type="string">'NULL'</Insert>
<Insert type="string">'InputRoot.MRM.Campo2'</Insert>
<Insert type="string">MF_Posicional.Compute</Insert>
</UserTrace>
- <UserTrace timestamp="2009-09-25 15:21:54.741580" thread="1736" function="SqlBinaryScalarFunctionCall::evaluate()" type="ComIbmComputeNode" name="MF_Posicional#FCMComposite_1_3" label="MF_Posicional.Compute" text="'Evaluation result'" catalog="BIPv610" number="2539" file="F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlFunctionCalls.cpp" line="492">
<Insert type="string">'.MF_Posicional_Compute.Main'</Insert>
<Insert type="string">'10.36'</Insert>
<Insert type="string">'NULLIF(NULL, NULL)'</Insert>
<Insert type="string">'NULL'</Insert>
<Insert type="string">'NULLIF(InputRoot.MRM.Campo2, NULL)'</Insert>
<Insert type="string">MF_Posicional.Compute</Insert>
</UserTrace>
- <UserTrace timestamp="2009-09-25 15:21:54.741611" thread="1736" function="SqlScalarEvalResult::assign" type="ComIbmComputeNode" name="MF_Posicional#FCMComposite_1_3" label="MF_Posicional.Compute" text="'assinging NULL to &1, thus deleting it'" catalog="BIPv610" number="2567" file="F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlAssignment.cpp" line="733">
<Insert type="string">'OutputRoot.XMLNSC.XML.campo2'</Insert>
<Insert type="string">MF_Posicional.Compute</Insert>
</UserTrace>
|
_________________ Oscar Vásquez Flores |
|
Back to top |
|
 |
kimbert |
Posted: Mon Sep 28, 2009 1:35 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Nope.
- You didn't use mqsiformatlog.
- That's only a tiny part of the user trace. It should be at least a few 10s of Kb in size. |
|
Back to top |
|
 |
|