Hi. I have a question regarding validation of zip codes. Right now, we are switching from RPG to Java. In our RPG programs, we always had a zip code table we used to validate the zip codes that the user keyed. How on earth does this work in Java?? Could someone please help! (If you can't tell, I'm a newbie!) Thanks a million!
posted 15 years ago
Using exactly the same logic that the RPG program did. If the Zipcode table is in a database, do a jdbc call to look up the value. If it is a unsorted flat file, use and input stream to read through and compare each value(yuch) If it is sorted, You can use RandomAssess File and perform a binary search of the contents. (If it is unsorted, I recommend a one-time through to read it in and rewrite it as a sorted file.)