View previous topic :: View next topic
|
Author |
Message |
ndilipan
New User
Joined: 11 Aug 2022 Posts: 2 Location: Netherlands
|
|
|
|
Hello,
I have a field which is declared as pic x(08) contains character.
01 WS-Date PIC X(08).
Having string value 52B30011 direct string not stored as hexadecimal . I want to convert this into decimal/integer value.
Expected value : 1387462673
Thanks in advance. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
This is a HELP forum, not a WRITE-THE-CODE-FOR-YOU forum. Once you've worked out the logic you need, if you have problems then you can post what the issue(s) are.
Hint: use reference modification to isolate each character, evaluate its value and multiply that value by the appropriate power of 16 and accumulate those values. |
|
Back to top |
|
|
ndilipan
New User
Joined: 11 Aug 2022 Posts: 2 Location: Netherlands
|
|
|
|
Hello Robert,
Thank you so much, I have written that logic multiplying by 16 with power sorry for not posting that in prior. I have posted to check, is there any function we can do it.
Thanks again!! |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
No, there is no function to do what you want. Intrinsic function HEX-TO-CHAR converts a hexadecimal value to a character string, but you already have the character string. And the NUMVAL intrinsic functions don't work on hexadecimal values, just decimal ones. |
|
Back to top |
|
|
|