Numeric to Alpha Translation
The attached subroutine will convert a numeric values to their alphabetic values. The number "4" converts to "four"; "25" converts to twenty five, etc. There is also an option that will allow you to change a numeric value into an alphabetic count. For example, 4 converts to "forth", "25" converts to twenty-fifth.
This routine was originally written as a means of check-protection for an accounts payable check-writing program. As an additional safety measure to asterisk-protection, the amount of the check is spelled out in full. Thus, if the numbers become smudged, the alphabetic values will still be there for verification.
The subroutine "NUMBER.TO.ALPHA1" can be called from any program for any NUMERIC Dollars-Cents attribute.
NUMBER = "127.35" CALL NUMBER.TO.ALPHA(NUMBER,INT.WORD,DEC.WORD,"0") CRT "NUMBER: ": NUMBER CRT "WORD: ": INT.WORD :" AND ": DEC.WORD :" CENTS" END
This will product the following results:
NUMBER: 127.35 WORD: ONE HUNDRED TWENTY-SEVEN AND THIRTY-FIVE CENTS
The second format allows you to display the number is counted format. The notice the change to the last argument from “0” to “1”:
Login to Read Complete Article.