Author |
Message
|
Dyanoo |
Posted: Wed Oct 26, 2022 1:11 am Post subject: Handling BCD values for lengthPrefix in DFDL |
|
|
Newbie
Joined: 20 Oct 2022 Posts: 4
|
Hi Everyone,
I came across an issue while creating DFDL for handling ISO8583 messages. My input message has few fields in LLVAR type where first 2 digits determine the length of the field, and length is provided in BCD.
Can anyone please help me in pointing to the right direction on how to handle BCD length values in DFDL..
For example,
ActNumber_Field2-104146516097772631(prefix 10 means 16 digits)
how to convert 10 to 16 in DFDL? |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Oct 26, 2022 12:42 pm Post subject: Re: Handling BCD values for lengthPrefix in DFDL |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Dyanoo wrote: |
Hi Everyone,
I came across an issue while creating DFDL for handling ISO8583 messages. My input message has few fields in LLVAR type where first 2 digits determine the length of the field, and length is provided in BCD.
Can anyone please help me in pointing to the right direction on how to handle BCD length values in DFDL..
For example,
ActNumber_Field2-104146516097772631(prefix 10 means 16 digits)
how to convert 10 to 16 in DFDL? |
You have to consider that your value is given in base 16, i.e. 10 =>16
Should not be that complicated to go from there...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
timber |
Posted: Thu Oct 27, 2022 6:58 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Are you reading the ISO8583 message, or writing it (or both)? |
|
Back to top |
|
 |
timber |
Posted: Thu Oct 27, 2022 2:57 pm Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
I suspect that the answer is here: https://daffodil.apache.org/docs/dfdl/ in section 12.3.4 dfdl:lengthKind 'Prefixed'
Probably best if you read that section first, then ask any questions that you have. That way, if I need to provide guidance you will have some background for me to work with. |
|
Back to top |
|
 |
timber |
Posted: Fri Oct 28, 2022 1:09 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Actually...I have some further questions re: your data format.
1. The length is '10' which is meant to be interpreted as the number 16. That is not 'BCD' - it would be represented as the byte value 00010011 (0x16) in BCD.
2. The value is '4146516097772631'. Is this 16 bytes, or 8 bytes?
3. What character encoding are these values in? (ASCII? EBCDIC? UTF-8?)
If possible, please can you supply the bytes of the input as well as the characters. DFDL works from the raw bytes, so that will answer all questions. |
|
Back to top |
|
 |
Dyanoo |
Posted: Sun Oct 30, 2022 5:30 am Post subject: |
|
|
Newbie
Joined: 20 Oct 2022 Posts: 4
|
Hi Timber,
Thanks a lot for your inputs....
Am reading the ISO8583 message.
The scenario am facing is,
ActNumber_Field2-104146516097772631
This field has prefix 10, that is 16 in hex followed by Account Number which is in bytes.
I need my prefixLength2 to read 10 as hex and convert it to decimal and to assign next 16 bytes to Account Number field.
Below is my input where 0100 is the MTI followed by primary and secondary bitmap.
0100f63c668108e0a0500000000004000000104146516097772631 |
|
Back to top |
|
 |
timber |
Posted: Tue Nov 01, 2022 10:59 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
|
Back to top |
|
 |
Dyanoo |
Posted: Thu Nov 03, 2022 1:48 am Post subject: |
|
|
Newbie
Joined: 20 Oct 2022 Posts: 4
|
Thanks Timber, I was able to resolve the issue by providing
textStandardBase="16" and type as type="hexBinary" for prefix length. |
|
Back to top |
|
 |
|