LPARAMETERS cDNS
LOCAL nCountryId, nSubStringLength
nCountryId = 0 && Invalid country code
IF VARTYPE(cDNS) = 'C' AND NOT EMPTY(cDNS)
FOR nSubStringLength = 7 TO 4 STEP -1
IF SEEK(LEFT(cDNS, nSubStringLength), 'country', 'ccode')
nCountryId = country.id
EXIT
ENDIF
ENDFOR
ENDIF
RETURN nCountryId
Thanx,
Bill Elvin