Some years ago I had a calculator in my palmtop computer which was able to perform calculations in hex. Then my palmtop broke down and I bought a new one which turned out to have a calculator without hex calculations. Then I invented the program presented in this tip and now I do not use external calculators any more.
My idea is to exploit all the many functions implemented in REXX. Especially REXX has a lot of functions for conversions. And REXX can perform ordinary calculations as well. The only thing missing now is the easiest possible way to translate an expression into a result. I call the following REXX for SAY because it SAYs the result of any REXX expression not only a limited subset:
The trick is to use the REXX statement INTERPRET which performs the result of the expression after keyword INTERPRET as a REXX statement. If I want to know what the hexadecimal value of ABCD is in decimal I simply execute the command TSO SAY X2D(ABCD) and the result is presented to me in the upper right corner of my ISPF screen. I can also perform calculations like 720*1348 or 27998%80*80. By the way % in REXX performs integer division.
You can execute SAY using any valid REXX expression which may be stored in X. If your input is a nonvalid REXX expression unable to be stored in X the REXX will fail miserably. If you are a clever REXX progammer you know how to trap the error from INTERPRET and return an error message explaining the situation, but I get along fine without.