Author |
Message
|
nize |
Posted: Thu Sep 03, 2009 6:07 am Post subject: XML schema datatypes date and decimal represented in CWF |
|
|
Voyager
Joined: 02 Sep 2009 Posts: 90
|
I used an xsd to generate a message set having the formats XML1 and CWF1. I get some warnings for the elements having the original datatypes date and decimal (http://www.w3.org/TR/xmlschema-2/). For decimal it was specified in the original schema that
totalDigits=15
fractionDigits=2
This information was not propagated to the message set as far as I can see.
The warning is "Element 'creditAmt' has default CWF Length Count of zero. [...]"
I have set the "Lenght count" of the decimal elements for CWF1 to 17 and for the date elements to 10, but still the warning appears in the tasks list of the toolkit. Should I change another field? Can this not be configured automatically?
I get a problem when the message is serialized in a flow for an element following an element of type date. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Sep 03, 2009 2:56 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Can this not be configured automatically? |
No it cannot. As a general rule, the xsd is describing the logical and XML forms of your data. The CWF physical format is describing how it looks on the wire. There is no reason why those two representations should be the same. You may think that xs:decimal and its facets are an exception to that general rule, but if so, it's not a common enough exception to make the feature worthwhile.
If you want the CWF physical format to be populated automatically, you can always construct a COBOL copybook and import it. |
|
Back to top |
|
 |
nize |
Posted: Thu Sep 03, 2009 10:55 pm Post subject: |
|
|
Voyager
Joined: 02 Sep 2009 Posts: 90
|
ok... I think I understand what you are pointing out.
Still, when I manually change "Lenght count" of the xs:decimal and the xs:date in the format CWF1 I still have the warning
"Element 'creditAmt' has default CWF Length Count of zero. [...]"
and I get an error in the MQOutput node when serializing an element after a date element in the sequence.
Is there another length field I should change? Are the lengths I set to short? Or is there something else wrong?
This is how I choose the lengths:
date: since there are 10 characters in the format "2009-09-04" I set "Lenght count":=10
decimal: since totalDigits=15, and I want room for fractions separator and minus character, I set "Lenght count":=17
Note: I use WMB 5.x |
|
Back to top |
|
 |
kimbert |
Posted: Fri Sep 04, 2009 1:21 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Still, when I manually change "Lenght count" of the xs:decimal and the xs:date in the format CWF1 I still have the warning
"Element 'creditAmt' has default CWF Length Count of zero. [...]"
|
I presume 'creditAmt' is the xs:decimal. You need to set the length in each place where creditAmt is used - CWF physical properties are not global.
Quote: |
Note: I use WMB 5.x |
Note: you will find v6.1 a vast improvement when you upgrade  |
|
Back to top |
|
 |
nize |
Posted: Fri Sep 04, 2009 1:44 am Post subject: |
|
|
Voyager
Joined: 02 Sep 2009 Posts: 90
|
yes you are right - it is a xs:decimal.
I will check if there are more instances on monday. I believe I changed it on the type object.
yes, I am working on WMB 6.1 as well, and yes there several benefits!
cheers |
|
Back to top |
|
 |
nize |
Posted: Sun Sep 06, 2009 10:43 pm Post subject: |
|
|
Voyager
Joined: 02 Sep 2009 Posts: 90
|
I looked for other occurrences where the length of either the date or the decimal fields were not set, but all of them had the length field ("width") set. Here is an extract from the .mxsd file:
Code: |
<xs:element name="repDate" type="xs:date">
<xs:annotation>
<xs:appinfo source="WMQI_APPINFO">
<cwfInclRep
messageSetDefaultRep="CWF1" repeatCount="1">
<cwfSimpleRep
format="yyyy-MM-dd" typeName="MRCWFDateTimeRep">
<MRCWFStringRep_MRCWFSimpleTD
encodingNull="NullPadFill"
lengthUnits="Bytes"
mrLengthEncoding="fixedLength"
paddingCharacter="NUL"
stringJustification="leftJustify" width="10"/>
</cwfSimpleRep>
</cwfInclRep>
</xs:appinfo>
</xs:annotation>
</xs:element>
...
<xs:element minOccurs="0" name="creditAmt">
<xs:annotation>
<xs:appinfo source="WMQI_APPINFO">
<cwfInclRep messageSetDefaultRep="CWF1">
<cwfSimpleRep
encodingNull="NullLogicalValue"
encodingNullValue="0"
lengthUnits="Bytes"
paddingCharacter="'0'"
signed="false"
stringJustification="rightJustify"
typeName="MRCWFExternalDecimalRep" width="17"/>
</cwfInclRep>
</xs:appinfo>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:totalDigits value="15"/>
<xs:fractionDigits value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
|
Below is the exception trace:
Code: |
EXCEPTION:
(
(0x01000000):RecoverableException = (
(0x03000000):File = '/build/S500_P/src/DataFlowEngine/ImbMqOutputNode.cpp'
(0x03000000):Line = 813
(0x03000000):Function = 'ImbMqOutputNode::evaluate'
(0x03000000):Type = 'ComIbmMQOutputNode'
(0x03000000):Name = 'SCFL230_credR_XMLtoCWF#FCMComposite_1_7'
(0x03000000):Label = 'SCFL230_credR_XMLtoCWF.MQOutput'
(0x03000000):Text = 'Caught exception and rethrowing'
(0x03000000):Catalog = 'BIPv500'
(0x03000000):Severity = 3
(0x03000000):Number = 2230
(0x01000000):ParserException = (
(0x03000000):File = '/build/S500_P/src/MTI/MTIforBroker/MtiImbParser2/MtiImbParser.cpp'
(0x03000000):Line = 1290
(0x03000000):Function = 'MtiImbParser::refreshBitStreamFromElements - 9 par'
(0x03000000):Type = 'ComIbmMQInputNode'
(0x03000000):Name = 'SCFL230_credR_XMLtoCWF#FCMComposite_1_1'
(0x03000000):Label = 'SCFL230_credR_XMLtoCWF.MQInput'
(0x03000000):Text = 'ImbRecoverableException caught from worker when attempting to write out the bitstream.'
(0x03000000):Catalog = 'BIPv500'
(0x03000000):Severity = 3
(0x03000000):Number = 5286
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'SCFL230_credR_MsgSet'
)
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '1'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'CWF1'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = ''
)
(0x01000000):ParserException = (
(0x03000000):File = '/build/S500_P/src/cpi/pwf/cwf/cwfworker.cpp'
(0x03000000):Line = 296
(0x03000000):Function = 'CWFWorker::write'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Text = 'CWF General Error'
(0x03000000):Catalog = 'BIPv500'
(0x03000000):Severity = 3
(0x03000000):Number = 5167
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '0'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'CWFWorker::write'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'credR'
)
(0x01000000):ParserException = (
(0x03000000):File = '/build/S500_P/src/cpi/pwf/cwf/cwfmessage.cpp'
(0x03000000):Line = 420
(0x03000000):Function = 'CMessage::write'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Text = 'CWF Writing error'
(0x03000000):Catalog = 'BIPv500'
(0x03000000):Severity = 3
(0x03000000):Number = 5350
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '0'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'CWFWorker::parseNext'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'credR'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '/credR/credRRec/creditAmt'
)
(0x01000000):ParserException = (
(0x03000000):File = '/build/S500_P/src/cpi/pwf/cwf/cwfcontext.cpp'
(0x03000000):Line = 372
(0x03000000):Function = 'CContext::CheckDefaultValue'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Text = 'CWF Logical Tree - Message Definition Mismatch'
(0x03000000):Catalog = 'BIPv500'
(0x03000000):Severity = 3
(0x03000000):Number = 5344
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'credR'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '79^creditNote'
)
)
)
)
)
)
)
|
It looks somewhat similar to http://www.mqseries.net/phpBB/viewtopic.php?p=209904
I will continue by
- comparing the width of creditNote in the message and in the model
- increasing the length of the date field which preceeds the creditNote
- checking if it could have something to do with the repeat setting
... in case you dont have any better suggestions...
It irritates me that I still have the warnings such as "Element 'creditAmt' has default CWF Length Count of zero". When I click on it, it doesnt take me to the code. My theory about this is that it is a bug in the WMB 5.x toolkit (i.e. not removing old warnings), but I am not convinced. |
|
Back to top |
|
 |
nize |
Posted: Sun Sep 06, 2009 10:59 pm Post subject: |
|
|
Voyager
Joined: 02 Sep 2009 Posts: 90
|
The length of the creditNote in the model was 12 and the no creditNote field in the message was longer than 8 so this implies that this is not the problem.
Edit: i am looking into the multiplicity (repeat) of the field since the minoccurrs = 0)
Edit: I am configuring how the parser will deal with missing elements and will check if that does the trick...
edit: I believe I am on the right track. at the moment I have "CField::write O/P Policy Missing Fields - No Null Value specified"... |
|
Back to top |
|
 |
kimbert |
Posted: Mon Sep 07, 2009 1:06 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I suggest that you start taking a user trace, instead of reading the raw exception list. User trace shows you the complete error message, instead of a cryptic summary of it. |
|
Back to top |
|
 |
nize |
Posted: Mon Sep 07, 2009 1:14 am Post subject: |
|
|
Voyager
Joined: 02 Sep 2009 Posts: 90
|
kimbert wrote: |
I suggest that you start taking a user trace, instead of reading the raw exception list. User trace shows you the complete error message, instead of a cryptic summary of it. |
thanks for the advice. I will look into that. At the moment I am trying to understand the "Encoding Null"/"Encoding Null Value" options. What I would like is to make all the fields having minoccurs=0 filling out missing elements with in a conventional way (spaces for strings? zeros for numbers?) ... Do I need to configure a default for every field manually? Which is the conventional way?
edit: can I not use the following settings:
On the element:
CWF1/Representation of null values/Encoding null: NullLogicalValue
CWF1/Representation of null values/Encoding null value:<empty>
Local element/Value/Nillable
On the message set:
CWF1/Policy for missing elements: Use Null Value
edit 2: it works when I use
CWF1/Policy for missing elements: Use Default Value
and specifies a default value for every element. Is there no nicer way? A common handling of all elements of a certain type, then creating default values having 7 spaces (in case of a string element of length 7)? |
|
Back to top |
|
 |
kimbert |
Posted: Mon Sep 07, 2009 2:53 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Some useful facts about MRM default and nil values:
- A default value supplies a logical value for an element which is missing from the message tree. Default values are never used when parsing.
- The null value settings allow you to supply either a replacement logical value OR the exact physical representation of an element which has a value, and that value is the value NULL. Null value settings are used when parsing and writing.
To answer your question, I'm afraid you have to specify a default value for each and every potentially-missing element. |
|
Back to top |
|
 |
nize |
Posted: Mon Sep 07, 2009 3:09 am Post subject: |
|
|
Voyager
Joined: 02 Sep 2009 Posts: 90
|
I edited the .mxsd file in the text editor and for all elements having minOccurs=0 I set ...
- nillable="true"
- encodingNull="NullLiteralFill"
- encodingNullValue="NUL"
Then it wrote the ouput message without problem, i.e. I didnt have to configure a default value depending on the type. Still I think it is strange that you need to configure this behavior on every element.
I guess my initial problem could be classified as solved, but as usual it leaves some questions/doubts open
thanks |
|
Back to top |
|
 |
kimbert |
Posted: Mon Sep 07, 2009 4:44 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Then it wrote the ouput message without problem, i.e. I didnt have to configure a default value depending on the type |
I'm not 100% certain that I understood that. I would be very surprised to learn that you can use null handling options to output elements which are missing from the message tree. I would like to see proof that there is at least one element where all of the following are true:
- it does not have a default value
- it is not in the message tree when the message arrives at the output node
- it is successfully written to the output using the null handling settings. |
|
Back to top |
|
 |
nize |
Posted: Mon Sep 07, 2009 5:14 am Post subject: |
|
|
Voyager
Joined: 02 Sep 2009 Posts: 90
|
I really believe I just did that with guidance by the v5 documentation (ad09255_):
Policy for Missing Elements
The setting of this property governs the action taken by the broker when fields are missing from the message tree when the message is serialized:
* Use Default Value (the default). If a Default Value exists for the element, output it; otherwise throw an exception.
* Use Null Value. If the Nillable property of the element is checked, and an Encoding Null Value is specified for the element, output the Encoding Null Value according to the rules defined by the Encoding Null property. Otherwise an exception is thrown.
Do you need more proof?  |
|
Back to top |
|
 |
kimbert |
Posted: Mon Sep 07, 2009 5:35 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
nize |
Posted: Mon Sep 07, 2009 5:48 am Post subject: |
|
|
Voyager
Joined: 02 Sep 2009 Posts: 90
|
Great that even a novice is able to make some kind of contribution sometimes, even if it concerns an outdated runtime  |
|
Back to top |
|
 |
|