Author |
Message
|
KIT_INC |
Posted: Fri Aug 03, 2012 1:09 pm Post subject: How to set Encoding Null Value ? |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
One of the fields of my message (MYMSG.DATA ) has a cobol definition of PIC X(85). Some times I am getting low value (x'00's) in that field. I like to detect the prblem to avoid causing other problems down stream.
I am reading the WMB V7 info center but I am not sure if I understand it correctly
http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ad00781_.htm
Quote: |
Custom wire format: NULL handling
CWF supports the handling of explicit NULL values within messages, provided that the logical nillable property of the element is set.
An explicit null is identified by a specific value that identifies an element as being null.
The Boolean Null Value can be specified at the message set level, and applies to the Boolean elements of all messages that are defined in that message set. The null value of all other element types can be specified individually for each element.
CWF supports the representation of null values using the Encoding Null and Encoding Null Value element properties. Together, this information controls how null values are handled by the MRM parser.
The Encoding Null property can be set to one of four values:
NullLogicalValue
The Encoding Null Value property is interpreted as a logical value. Therefore, if its value is set to 0, for example, both 0 and 0.00 are interpreted as null values. |
An explicit null is identified by a specific value that identifies an element as being null
Does this mean that if the field contains a value specified by Encoding Null Value , that field will be considered as NULL ? If my understanding is wrong, please help me.
If my understanding is right, here is what I tested
In the message defintion for that field I have
Logical properties/logical element - Nillable checked
Physical properties/Binary1/local element - Encoding Null set to NullLogicalValue and Encoding Null Value = 0
I use esql
If InputRoot.MRM.MYMSG.DATA IS NULL THEN....
I was hoping that I can detect the low value and take some action.
But this test is not working because InputRoot.MRM.MYMSG.DATA is not considered as NULL.
I probably read the info center wrong or not specifying the
Encoding Null Value correctly. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Aug 03, 2012 2:07 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
First off, make sure you are actually using CWF, and not TDS instead...
Then check
Code: |
If FIELDVALUE(InputRoot.MRM.MYMSG.DATA) IS NULL THEN.... |
Because the element may exist (and thus not itself be null) but have a Null value instead.
EDIT: And, of course, always use a Trace node to put out the message tree when trying to debug message definition behavior. Make sure you know what is being produced for InputRoot.MRM.MYMSG.DATA...  |
|
Back to top |
|
 |
kimbert |
Posted: Fri Aug 03, 2012 3:19 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Your understanding is correct - the CWF settings control how a NULL value is represented in the input or output bit stream. Your CWF settings are probably also correct. But you are missing one important detail; you need to set the 'nillable' property to 'true' ( it is a logical property, not a CWF property so it is very easy to miss ). |
|
Back to top |
|
 |
KIT_INC |
Posted: Fri Aug 03, 2012 4:31 pm Post subject: |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
Hi Kimbert,
Quote: |
you need to set the 'nillable' property to 'true' ( it is a logical property, not a CWF property so it is very easy to miss ). |
In my first post
Quote: |
In the message defintion for that field I have
Logical properties/logical element - Nillable checked
|
Is this what you are referring to ? or this is another check box hiding somewhere? |
|
Back to top |
|
 |
KIT_INC |
Posted: Fri Aug 03, 2012 7:53 pm Post subject: |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
Quote: |
you need to set the 'nillable' property to 'true'
|
I cannot find another place other than the check box under Logical properties/logical element for that field.
I changed my esql to
IF FIELDVALUE(InputRoot.MRM.MYMSG.DATA) IS NULL THEN... END IF;
But it is not working. Trace shows that the field is '00000000000000...' and not NULL
Quote: |
012-08-03 23:30:41.505023 4036 UserTrace BIP2540I: Node 'Unlike_parser_copy.Compute': Finished evaluating expression ''FIELDVALUE(InputRoot.MRM.MYMSG.DATA)'' at ('.Unlike_parser_copy_Compute.CopyEntireMessage', '4.6'). The result was '''0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
000000000000000000000000'''.
2012-08-03 23:30:41.505039 4036 UserTrace BIP2540I: Node 'Unlike_parser_copy.Compute': Finished evaluating expression ''FIELDVALUE(InputRoot.MRM.MYMSG.DATA) IS NULL'' at ('.Unlike_parser_copy_Compute.CopyEntireMessage', '4.54'). The result was ''FALSE''. |
I also tried with Encoding Null Value = x'00' with no luck |
|
Back to top |
|
 |
rekarm01 |
Posted: Fri Aug 03, 2012 9:57 pm Post subject: Re: How to set Encoding Null Value ? |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
KIT_INC wrote: |
Physical properties/Binary1/local element - Encoding Null set to NullLogicalValue and Encoding Null Value = 0 |
From the usertrace, it looks like the Null Value is supposed to be the alphanumeric character '0', not the value 0. For character data, setting Encoding Null = NullLiteralFill and Encoding Null Value = '0' may work better. |
|
Back to top |
|
 |
KIT_INC |
Posted: Sat Aug 04, 2012 8:21 am Post subject: |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
Encoding Null = NullLiteralFill and Encoding Null Value =0x00 works
Thanks for all the help. |
|
Back to top |
|
 |
|