× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



David,

Your "requirements" as stated are not totally clear ...   perhaps you can describe a suggested "use case"?


Is your "hex characters" input a human-readable string of hexadecimal characters, e.g. in EBCDIC, that proposed value of 'BC614E' would actually be represented in memory as x'C2C3F6F1F4C5'? 


By "decimal" do you mean "packed decimal" or "zoned decimal"?

Do you want the result as human-readable characters, or do you want the result as a binary integer?

There are MI instructions to convert from hex to character and vice versa, see:  cvthc and cvtch   You can invoke those MI instructions as "built-in" functions directly from any ILE language.

You could write a small ILE RPG IV "wrapper" to turn those into SQL callable functions.

Does that help?

Mark S. Waterbury



On Monday, September 9, 2019, 8:47:47 AM EDT, David Gibbs via RPG400-L <rpg400-l@xxxxxxxxxxxxxxxxxx> wrote:

Folks:

Does anyone have a routine handy (or know of an API) that will convert
hex characters to decimal or integer?

For example: If I have the character value 'BC614E' I would get
12345678 returned.

I had hoped there would be something in SQL, since there is a HEX
function that will convert a numeric into character hex, but it
doesn't appear to exist.

Thanks!

david


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.