Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Zip code tables

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.)

------------------
Hope This Helps
Carl Trusiak, SCJP2
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic