ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Decimal with explicit sign in DFDL model

Post new topic  Reply to topic
 Decimal with explicit sign in DFDL model « View previous topic :: View next topic » 
Author Message
ediman
PostPosted: Thu Jun 06, 2013 12:17 am    Post subject: Decimal with explicit sign in DFDL model Reply with quote

Newbie

Joined: 05 Jun 2013
Posts: 9

Hi all,
I am a newbie of this forum.
I hope someone can help me.

I'm migrating an integration project from message broker 6 to message broker 8, and I'm changing all messages definition from MRM model to DFDL model.

We have input messages as flat file with fixed lenght records.
Some fields of the record are 12 characters signed decimals with an implied decimal point before the last 3 characters, and the sign is always present as leading character.
So I can read +00000312043, that means +312.043, or -00000312043, that means -312.043.

I use DFDL editor to define the message structure, but I can't get the correct logical representation of the number.

This is how I defne the decimal content

Representation -> text
Length Kind -> explicit
Length -> 12
Lenght Units -> characters
Nilable -> false
Default Value -> unset
Fixed Value -> unset

and text content

Decimal Signed -> yes
Text Number Representation -> standard
Number Base -> 10
Text Number Check Policy -> lax
Number Pattern -> 000000000V000
Number Giustification -> right
Number Pad Character -> 0

I use the "Test Parse Model" to test the message structure with a test file, but with this number pattern I can read only negative number, if I find a positive number I get the error "Character '+' at offset '0' cannot be parsed".

If I use the Number Pattern "+00000000V000" I can read only poisitive number.

If I try to use "+00000000V000;000000000V000" I get the error in the DFDL editor
"CTDM2404E : ''+00000000V000;000000000V000'' is not a valid DFDL number pattern".

It seems that is some problem with V symbol.

How can i sove this problem and use a Number Pattern to read both positive and negative numbers ?

As workaround I can define a field with a single character for the sign and a decimal field with no sign for the number, and then convert to decimal signed in the ESQL, but I prefer not to do it if I can solve it in the DFDL.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Jun 10, 2013 5:05 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

There is a defect in the IBM DFDL implementation. It only allows the 'V' symbol to be used when textNumberRepresentation is 'zoned'. But your numbers are not zoned decimals, so you should not use that setting.

I think your best option to use the pattern "+00000000000;-000000000000" ( same as yours, but without the V and with the sign included in the second half of the pattern). This will parse your number as an unscaled integer value, and you will need to apply the scaling in the message flow logic.

I will follow this up internally and get it fixed.
Back to top
View user's profile Send private message
ediman
PostPosted: Mon Jun 10, 2013 6:24 am    Post subject: Reply with quote

Newbie

Joined: 05 Jun 2013
Posts: 9

Thank you very much Kimbert, I will follow your suggestion.
Back to top
View user's profile Send private message
shyamkumarsharma001
PostPosted: Fri Sep 04, 2015 1:23 am    Post subject: Reply with quote

Novice

Joined: 24 May 2011
Posts: 18

Hi, I have similar kind of issue where I am receiving an xml input and 1 of the field in input has value coming as signed decimal (000012345678+)
The output is fixed length format and I am sending to MainFrame.

Message set is built out of COBOL copybook and the properties of that field are:
Physical Type: External Decimal
Length: 12
Lenth Units : Bytes
Padding: 0
Signed: Yes
Sign Orientation: Trailing Separate.

Field is of type : xsd:decimal

When Output node tries to write bitstream data, broker throws exception as below:

BIPMsg number 5505
CPI Converter input data Invalid

<Function>DataConv:StrToDec</Function>
<Insert>
<Type>5</Type>
<Text>DECIMAL</Text>
</Insert>
<Insert>
<Type>5</Type>
<Text>STRING</Text>
</Insert>


<Insert>
<Type>5</Type>
<Text>STRING</Text>
</Insert>
<Insert>
<Type>5</Type>
<Text>000012345678+</Text>
</Insert>

The trace after compute node has same value as 000012345678+ in that field but I feel '+' sign is not getting parsed because it is of string type and not a sign. I am not sure what is the issue here.
Any help is highly appreciated.
Back to top
View user's profile Send private message
timber
PostPosted: Fri Sep 04, 2015 2:35 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

DFDL's type system is a subset of XML Schema's type system. If you want to supply a decimal value to DFDL then it must be one of
- an ESQL DECIMAL value
or
- an ESQL CHARACTER value, conforming to the lexical format of the xs:decimal simple type ( http://www.w3.org/TR/xmlschema11-2/#decimal )

Your input value is a CHARACTER, but it is not a valid lexical representation of an xs:decimal.

Solution:
- Find out the exact format of the input value. Is it always an integer? Can it be negative?
- Review the information here: https://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak05615_.htm
- Write some ESQL code to CAST the input string to a DECIMAL value. I don't know whether ESQL CAST allows a trailing sign. If not, you may have to remove the sign and adjust the result of the CAST yourself.
Back to top
View user's profile Send private message
shyamkumarsharma001
PostPosted: Tue Sep 08, 2015 2:07 am    Post subject: Reply with quote

Novice

Joined: 24 May 2011
Posts: 18

timber wrote:
DFDL's type system is a subset of XML Schema's type system. If you want to supply a decimal value to DFDL then it must be one of
- an ESQL DECIMAL value
or
- an ESQL CHARACTER value, conforming to the lexical format of the xs:decimal simple type ( http://www.w3.org/TR/xmlschema11-2/#decimal )

Your input value is a CHARACTER, but it is not a valid lexical representation of an xs:decimal.

Solution:
- Find out the exact format of the input value. Is it always an integer? Can it be negative?
- Review the information here: https://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak05615_.htm
- Write some ESQL code to CAST the input string to a DECIMAL value. I don't know whether ESQL CAST allows a trailing sign. If not, you may have to remove the sign and adjust the result of the CAST yourself.


Thanks very much to point me to the exact place where the issue was. When I cut and add the sign from trailing position to leading position, esql can cast that number to decimal without any problem. And the good part of it is, We don't need to add the sign part on the trailing side of the number manually to parse it with message set. Once the number has been casted to decimal, the message set can parse that field and broker can write the bitstream in the format message set has been defined ( In my case sign is in trailing side)

So, If my input is 12345+
I truncate the sign from trailing position and put it to leading position.
+12345
I then cast that number as Decimal
And directly parse this number to xsd:int field which has properties as
Physical Type: External Decimal
Signed is ticked and sign orientation is Trailing separate
The output from broker would be 12345+
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Decimal with explicit sign in DFDL model
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.