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.