REPLACE fphone WITH STR(m.q) &&replacing the phone number field with m.q as a string CHRTRAN(fphone, "-", "") && removing dashesYou're replacing after the fact. Also in STR use 15 as a second parameter just in case.
&&SELECT 0 &&Assign the epa_facility_info table to 1. >USE epa_facility_info exclusive && we need exclusive access if we want to pack the table - do we need it? >DELETE ALL &&Deletes all the outdated records. >PACK && Removes the deleted records from the table *The two lines above should be replaced with ZAP then . >SELECT 3 &&Assign the textfile which is now a remote view to 3. ** Never specify number for the select area use SELECT 0 instead & >USE surface_water!facgeo >*GO TOP &&Move to the top of the table. >*DO WHILE NOT EOF() &&Loop through the table record by record. SCAN > IF not ALLTRIM(f1) == "NPID" > STORE ALLTRIM(f1) TO m.a > STORE VAL(f2) TO m.b > STORE VAL(f3) TO m.c > STORE ALLTRIM(f4) TO m.d > STORE ALLTRIM(f5) TO m.e > STORE ALLTRIM(f6) TO m.f > STORE ALLTRIM(f7) TO m.g > STORE ALLTRIM(f8) TO m.h > STORE ALLTRIM(f9) TO m.i > STORE ALLTRIM(f10) TO m.j > STORE ALLTRIM(f11) TO m.k > STORE ALLTRIM(f12) TO m.l > STORE ALLTRIM(f13) TO m.m > STORE RIGHTC(ALLTRIM(f14),3) TO m.n > STORE ALLTRIM(f15) TO m.o > STORE ALLTRIM(f16) TO m.p > * STORE VAL(LEFTC(ALLTRIM(f17),3)+SUBSTR(ALLTRIM(f17),5,7)) TO m.q && this is the phone number entry, it is originally numeric >* * CHRTRAN(m.q, "-", "") all next lines should be replaced with INSERT INTO Epa_Faculity_Info () ; values () > SELECT 1 &&Select the epa_facility_info table. > APPEND BLANK &&Adds a blank record to populate the fields with the variables. > REPLACE npid WITH m.a > REPLACE fllc WITH m.d > REPLACE fllm WITH m.e > REPLACE fllt WITH m.f > REPLACE flls WITH m.g > REPLACE flld WITH m.h > REPLACE facrwat WITH m.i > REPLACE huc WITH m.j > REPLACE fstr1 WITH m.k > REPLACE fstr2 WITH m.l > REPLACE fcity WITH m.m > REPLACE fcnty WITH m.n > REPLACE fstate WITH m.o > REPLACE fzip WITH m.p > REPLACE fphone WITH STR(m.q) &&replacing the phone number field with m.q as a string > CHRTRAN(fphone, "-", "") && removing dashes > REPLACE latitude WITH m.b > REPLACE longitude WITH m.c > SELECT 3 &&Select the remote view again. > ENDIF > IF EOF() &&Check for end of file. > EXIT > ELSE > SKIP > ENDIF >ENDDO >>