General information
Category:
Coding, syntax & commands
Please take a look at the code below:
** the last one is the verify digit
LN = VAL (DIRETO.REG)
endif
FOR lnCounter = 1 TO LEN(ALLTRIM(STR(ln)))
lcVarName = 'lcVarName' + ALLTRIM(STR(lnCounter))
&lcVarName = INT(VAL(substr(trans(ln),lnCounter,1)))
ENDFOR
R1 = lcVarName1
R2 = lcVarName2
R3 = lcVarName3
R4 = lcVarName4
R5 = lcVarName5
R6 = lcVarName6
R7 = lcVarName7
R8 = lcVarName8
DV = lcVarName9
Sum = (R1 * 8) + (R2 * 6) + (R3 * 4) + (R4 * 2) + (R5 * 3) + (R6 * 5) + (R7 * 9) + (R8 * 7)
REST1 = MOD(Sum, 11)
DO CASE
CASE REST1 = 0
DV1 = 5
CASE REST1 = 1
DV1 = 0
OTHER
DV1 = 11 - REST1
ENDCASE
IF DV1 # DV
= MESSAGEBOX ("invalid code")
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only