Author |
Message
|
muthu121521 |
Posted: Wed May 29, 2019 1:48 pm Post subject: DFDL Parser Issue with Trimming Zeros. |
|
|
Apprentice
Joined: 31 Aug 2015 Posts: 36
|
We are getting the COBOL copybook response , which is a packed decimal 9 byte.
Lets say if that binary packed decimal is 000091184,We are getting only 91184, all of the leading zero's are trimmed, how do we prevent trimming the leading zeros, What re the additional settings we can do at the element level to prevent it from occurring ? |
|
Back to top |
|
 |
timber |
Posted: Thu May 30, 2019 2:05 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
The value of the field is 91184 (a number)
The physical format of the field in the input message is '000091184' (a string of characters)
The message tree contains the parsed value of the field, which is a number.
Quote: |
We are getting only 91184, all of the leading zero's are trimmed, how do we prevent trimming the leading zeros, What re the additional settings we can do at the element level to prevent it from occurring ? |
Why do you want the leading zeros? They are not part of the value of the element. I think I can guess what your answer will be, but I might be wrong. Please explain the scenario. |
|
Back to top |
|
 |
muthu121521 |
Posted: Thu May 30, 2019 4:58 am Post subject: |
|
|
Apprentice
Joined: 31 Aug 2015 Posts: 36
|
Hi Timber,
Thanks For your Response, Its actually a Timefield in the format of HHmmssSS, if the zeros are discarded i am not able to set the response correctly. |
|
Back to top |
|
 |
Vitor |
Posted: Thu May 30, 2019 4:58 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
timber wrote: |
The physical format of the field in the input message is '000091184' (a string of characters) |
With respect:
muthu121521 wrote: |
Lets say if that binary packed decimal is 000091184 |
So it's a string of bytes with a digit in each nibble (probably described in the COBOL copybook as S9(9) COMP-3.
However:
timber wrote: |
The message tree contains the parsed value of the field, which is a number. |
timber wrote: |
Why do you want the leading zeros? They are not part of the value of the element. I think I can guess what your answer will be, but I might be wrong. Please explain the scenario. |
I would also point out that if you asked the COBOL program sending the response what the value of that field was, it would tell you it was 91184 not "0000091184" because the field definition is S9(9) COMP-3 not 9(9). Exactly how the DFDL parser is describing it.
So explain why you need the character value in the message tree _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Thu May 30, 2019 5:00 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
muthu121521 wrote: |
Its actually a Timefield in the format of HHmmssSS, if the zeros are discarded i am not able to set the response correctly. |
So why isn't it described in the DFDL model as a time field? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
muthu121521 |
Posted: Thu May 30, 2019 5:06 am Post subject: |
|
|
Apprentice
Joined: 31 Aug 2015 Posts: 36
|
We got the response copybook from the mainframe team as element name as below
15 elementxxxx PIC S9(09) COMP-3. 00179700
* ** FORMAT = 0HHMMSSTH ** 00179800
even then we are getting the leading zeros's trimmed |
|
Back to top |
|
 |
Vitor |
Posted: Thu May 30, 2019 5:22 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
muthu121521 wrote: |
We got the response copybook from the mainframe team as element name as below
15 elementxxxx PIC S9(09) COMP-3. 00179700
* ** FORMAT = 0HHMMSSTH ** 00179800
even then we are getting the leading zeros's trimmed |
Well pardon my astonishment :sarcasm emoji:
Notice the '*' before the e of 'element'? That's how COBOL indicates a comment. So the programmer has helpfully documented that the field value contains a time stamp, and is to be congratulated for doing so.
It's still a number. COBOL thinks it's a number, so any DFDL model built from that definition will think it's a number. For the record, COBOL doesn't have a data type for time stamp, hence the use of a COMP-3 to hold this.
If you want this parsed as a time stamp, you'll have to explain to DFDL that it's a time stamp. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
timber |
Posted: Thu May 30, 2019 1:21 pm Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
if the zeros are discarded i am not able to set the response correctly. |
I do not understand that statement. What is the format of the response? If it is another COBOL copybook, then surely you can just put the number value from the message tree into OutputRoot.DFDL and DFDL will put the leading zeroes in when it writes the output message.
Please
a) describe the output format that you need
and
b) explain what happens (in the output message, not in the message tree) when you do what I suggest above. |
|
Back to top |
|
 |
|