I did something like this but I have no idea if it's even close yet, I can't get it to print the results.
proIn = 66012340
lnDigit = m.proIn - (INT(m.proIn / 9) * 9)
chkdig = 9 - lnDigit
?chkdig
>I've done one of these before but it was a long time ago and I've since trailed away from VFP. Basically, I need to calculate a check digit using the MOD9 formula:
>
>
>Check Digit = 9 – (Pro – (Int (Pro / 9) * 9))
>
>I have a start and end text box on a form, you put the beginning and ending numbers in there and it generates the range of numbers and performs the calculation. I need help translating the formula to VFP code.
>
>
>Example of the other formula from awhile ago:
>
>
http://www.augustana.ab.ca/~jmohr/algorithms/checkdigit.html>
>Using the IBM formula from that page, this code is being used:
>
>
>
>
IF LEN(proIn)<>8 AND LEN(proIn)<>9
> RETURN " "
> ENDIF
> WS_SUM = 0
> FOR i=1 TO 8
> WS_SUM = m.WS_SUM + VAL(SUBSTR(m.proIn,m.i,1)) * ( 10-m.i )
> ENDFOR
> WS_SUM_INT = Int(WS_SUM / 11)
> WS_REM = m.WS_SUM - m.WS_SUM_INT*11
> WS_CHECK = (11 - m.WS_REM)
> IF WS_CHECK > 9
> WS_CHECK = WS_CHECK - 10
> ENDIF
> chkdig = TRANSFORM(WS_CHECK)
>
>That works fine for that formula, but I can't get something going for the MOD9 I listed above.