I know the is the RPG list bu REXX has a function to do this.
I've used the following for *years

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* XCALC EXP('REVERSE("String")') */
/* _____________________________________________________________ */
/* */
/* Yet another *FREEWARE* utility from Prime Suspect Software, */
/* creating slightly above average products for the */
/* enlightened masses since 1982. */
/* _____________________________________________________________ */
/* */
/* REXX Program Name... XCALC */
/* Programmer.......... Matt Sargent */
/* Internet Address.... M.SARGENT@xxxxxxxxxxxxxx */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

signal on syntax

parse arg string
parse value space(string) with "'"expression"'"
interpret 'answer =' expression
answer = strip(expression) '=' answer
'SNDPGMMSG MSG(&answer)'
exit

syntax:
syntaxerr = errortext(rc)
'SNDPGMMSG MSG(&syntaxerr)'

================

CMD PROMPT('Expression Calculator')
PARM KWD(EXP) TYPE(*CHAR) LEN(256) MIN(1) +
CHOICE('Character value') +
PROMPT('Mathmatical expression')

=========

d2x() is the REXX function to convert Decimal to heXdecimal. The
data conversions available in the AS400 implementation of REXX are:
b2x() binary to hex
x2b() hex to binary
c2d() character to decimal (EBCDIC)
d2c() decimal to character (EBCDIC)
c2x() character to hex (EBCDIC)
x2c() hex to character (EBCDIC)
d2x() decimal to hex
x2d() hex to decimal

Bryan


Raul Jager wrote on 9/9/2019 10:20 AM:

On 9/9/2019 8:59 AM, David Gibbs via RPG400-L wrote:
On Mon, Sep 9, 2019 at 7:47 AM David Gibbs <david@xxxxxxxxxxxx> wrote:
Does anyone have a routine handy (or know of an API) that will convert
hex characters to decimal or integer?

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.