送一个身份证号15位转18位的程序:
PARAMETERS cSFZ15
cSFZ15 = ALLTRIM(cSFZ15)
IF LEN(cSFZ15)<>15 AND LENC(cSFZ15)<>15
RETURN "不是15位身位证号码!"
ELSE
IF NOT CHRTRAN(cSFZ15,"1234567890","")==""
RETURN "含有非数字,不是身位证号码!"
ENDIF
cSFZ17 = STUFF(cSFZ15,7,0,'19')
cBy17='7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2'
cCheck='10X98765432'
nCheck=0
FOR nCnt=1 TO 17
nCheck=nCheck+VAL(SUBSTR(cSFZ17,nCnt,1))*VAL(GETWORDNUM(cBy17,nCnt,','))
NEXT
RETURN cSFZ17+SUBSTR(cCheck,nCheck%11+1,1)
ENDIF