Yea, You might be right.
I don't think there is much danger in losing data. It would run just in this program.
{City} {Cty} {RG}
[KPHX][12548][Renoio][Peru][SB][41.5101654][-125.4156]
This is the one of the finished product of this program.
However it could be: [KPHX][12548][Nil][Nil][Nil][41.5101654][-125.4156] because the City and Country didn't validate and the region code wasn't entered.
It's an old record. Now they require region and country. Not City, some airports are in the wilderness.
On the generation of these records I will have 9,000 +/- 7 field records and about 26,200
with 1 to 3 Nil's in each record.
If the Nil is in the country field but the record has a region 'K1' the country is United States.
'LE' Spain.
No Region, or Country but city (Rare occurrence) but i can search for city in the 9,000 records group, they all have all there fields filled out. if found I know the country and maybe the region. ( Some countries have multiple regions).
Three Nil fields. Difficult but not impossible. I have written and tested a program that will do the 'Haverstine' form any location to any location.
All records must have ICAO, Hash, Lat and lon info. Pick one of the records with 3 Nils and do a haverstine against the 9,000 good records. You can set a distance say 10 miles.
Airport 'A' and airport 'B' are within 10 miles of one another they are probably in the same Country maybe in the same region.
You can also run 'A' and 'B' against 'Middle Latitudes and Longitudes'. These are airport's in the center of each country. For the US it's Kansas City for Spain it's Madrid.
Adjust the distance to 400 miles. Any record that get a Haverstine distance within the 400 would be in Spain and a Region code of LE. 100 miles from Kansas City is in the U.S. but maybe not a K1 region.
City: Any airport within 5 miles of a city would get the city name in the City fields.
You start very small say 5 miles against the 'Middle Latitudes and Longitudes', run the 9,000 against the 26,000. Reload the 9,000 and it might be 9,400. Widen the distance say to 25 miles and go again. Reload and go to 65 miles. The 9,000 will grow after about 4 runs to 14,000. and the 26,000 will shrink to 21,000. Then you go back to 25 miles. Because you have a large sampling of good records you can get 1,2 4 miles from known cities and airports. Phoenix area has 9 airports.
I ran all this with a set of bad data. I know have a data file of airports that is correct as far as airport ICAO. KPHX, KJFK ect. Trying to validate as much data a possible before I go to Haverstine.
Long way of saying need to validate the records verify the numbers.
Thanks All.