Kevin this works great! Except for invalid data like when NUM equals 0, null
or a negative.

I'm going to convert it to a function, which will work better for my need.

Thanks,
David A. Green
DAG Consulting
-----Original Message-----
>Does any one have a Digit to Roman Numeral converter they would like
to share?

How about this?  I just whipped this up on your request using
information from http://www.novaroma.org/via_romana/numbers.html .
That was kinda fun!

SUBROUTINE ROMAN.NUMERALS(NUM,ROMA)
*
* Written By:  Kevin King
* Date:        18 Oct 2006
* Project:     Basic Entertainment
* Description: This subroutine will convert a number (NUM) to Roman
numerals
*              (ROMA).
*
**********************************************************************
*******
* Modifications
**********************************************************************
*******
* Date.....  Changed By.....  Description of
Change..........................
*
DIVISORS = '1000,900,500,400,100,90,50,40,10,9,5,4,1'
NUMERALS = 'M,CM,D,CD,C,XC,L,XL,X,IX,V,IV,I'
*
THIS.NUM = NUM
ROMA     = ''
*
LOOP
UNTIL (THIS.NUM EQ 0) DO
  DONE = @FALSE
  FOR DIVISOR.LOOP = 1 TO 13 UNTIL DONE
    DIVISOR = FIELD(DIVISORS,',',DIVISOR.LOOP)
    IF (THIS.NUM GE DIVISOR) THEN
      ROMA := FIELD(NUMERALS,',',DIVISOR.LOOP)
      THIS.NUM -= DIVISOR
      DONE = @TRUE
    END
  NEXT DIVISOR.LOOP
REPEAT
*
RETURN
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to