|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
DFDL model to handle bcd fields |
« View previous topic :: View next topic » |
Author |
Message
|
mindspace |
Posted: Fri Jul 13, 2018 6:25 am Post subject: DFDL model to handle bcd fields |
|
|
Apprentice
Joined: 22 Jan 2013 Posts: 26
|
Hello DFDL gurus,
I am trying to create a DFDL model for my project, the incoming message(ebcdic) is having a bcd field and the value is 104999999091232631(include length prefix -10 (in hex form)) and the actual account number - 4999999091232631(which is 16 digits)
Field Attributes:
variable length
1 byte, binary +
19 N, 4-bit BCD (unsigned packed); maximum 11 bytes
I have defined the
length prefix as length: 1 byte, type: UnsignedInt, representation: binary, binary content-number representation: lax, binary,byteorder: bigendian
And
account number as type: integer, length units: bytes, length: length prefix, representation:binary,binary content-number representation: lax, bcd
But this is returning me a value with 32 digits not 16 digits...I see prefix length type is returning correct value 16, but treating it as 16 bytes at the field level and as the field is defined as bcd (‘bcd’ means represented as a binary coded decimal with two digits per byte.)
Can some one please advise me what is the right way to model this field using DFDL? |
|
Back to top |
|
 |
timber |
Posted: Mon Jul 16, 2018 5:11 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Well...you have told DFDL that lengthUnits is 'bytes' and length is 16, so it has (quite reasonably) extracted 16 bytes. Sounds as if the sending application wants to define the length in 'nibbles' (half bytes). That's a reasonable decision, but DFDL does not support lengthUnits='nibble'.
The solution is to define the length as a completely separate element. Then set the length of your BCD field using an XPath expression that calculates the BCD length from as (the value of the length field)/2. |
|
Back to top |
|
 |
mindspace |
Posted: Mon Jul 16, 2018 7:05 am Post subject: |
|
|
Apprentice
Joined: 22 Jan 2013 Posts: 26
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|