In AS/400 query how do you change an alpha field into a numeric to do math on it?
Example: VARIABLE is defined as an alpha field 4 characters long and has the value “1234” in it.
I want to add VARIABLE and the field SCORE together to get a sum, what command do I use in query to redefine VARIABLE
as a numeric field?
I believe DIGITS(NumericField) will do the trick.
I believe this will convert Numeric to Character, but not Vice-versa.
There is only a limited way of converting alpha to numeric within query/400. This involves convrting the alpha field to the microsecond portion of a time stamp.
Because it is so convoluted and down outright bizzar I avoid it as much as is humanly possible.
Use another high level language or create some dds in qtemp and copy the file with nocheck is what I would recomend.
Best of Luck
The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln
Thanks for this info.