Integrating ZIP/CITY into your application programs
Integrating ZIP/CITY into your own software is a relatively easy process. We provide sample RPG source code with examples of all the code you'll need. The sample source code is stored in source member #RPGSAMPLE in source file QRPGSRC in library ZCLIB. All of these programs are called in typical AS/400 fashion. A call to the program is followed by a parameter list.
Here is a summary of the callable programs (or API's, Application Program Interfaces.)
ZC0010 - Select a ZIP Code Program ZC0010 displays a screen and allows you to select a ZIP Code from an alphabetic list of cities within each state. If a selection is made, the ZIP Code is returned. This is the only parameter.
ZC0011 - Select a ZIP Code, City, and State from a List Program ZC0011 displays a screen and allows you to select a ZIP Code, city, and state from an alphabetic list. If a selection is made, the ZIP Code, city and state will be returned as parameters. You may specify the city name to be returned as all uppercase or mixed case.
ZC0020 - Calculate the Distance between Two ZIP Codes Program ZC0020 Calculates the air-line distance between two ZIP Codes. No screen is used. The input is two valid ZIP Codes and the air-line distance is returned in miles and in kilometers. No screen is used.
ZC0021 - Select ZIP Codes within X Miles of a Selected ZIP Code Program ZC0021 selects all ZIP Codes within a specified number of miles of a central ZIP Code. No screen is used. The selected ZIP Codes are placed in a data file. The file of selected ZIP Codes can then be used as "finder" records in another application program. Sample CL code is also provided showing how to implement ZC0021.
ZC0200 - Return the City and State for a Specified ZIP Code Program ZC0200 uses no screen. The only input is a ZIP Code. The US Postal Service preferred name and state are returned.
ZC0201 - Return All City Names for a ZIP Code Program ZC0200 uses no screen. The only input is a ZIP Code. All matching city names are returned. This program allows you to discover all possible city names recognized by the US Postal Service. There is a preferred name indicator. Another indicator tells if the names are acceptable mailing names.
ZC0205 - Return the Offical Postal City Name Abbreviation Program ZC0205 will provide the offical US Postal Service abbreviation for any city name that exceeds thirteen characters. No screen is used. The input is the ZIP Code and the only returned parameter is the abbreviated city name. If the original city name does not exceed thirteen characters, no abbreviation is returned.
ZC0210 - Return County Information Based on ZIP Code Program ZC0210 will provide the county name, state code, and county FIPS code based on ZIP Code. No screen is used. The only input is the ZIP Code. If a match is found, the county name, county FIPS code, and state code will be returned.
ZC0215 - Return Area Code and Time Zone Based on ZIP Code Program ZC0215 will provide the telephone area code and time zone based on ZIP Code. The only input is the ZIP Code. If a match is found, the telephone area code and time zone are returned. Some areas of the county are now being assigned overlay area codes, so two area codes might be valid for a ZIP Code. Program ZC021501 will return the overlay area code and the effective date of the overlay.
ZC0217 - Return Latitude and Longitude Based on ZIP Code Program ZC0217 will provide the average latitude and longitude for a given ZIP Code. The only input is the ZIP Code. If a match is found, the latitude and longitude for that ZIP Code will be returned. An error code parameter is also given. If the error code parameter is blank, a good match was found. If the error code parameter is not blank, no match for the ZIP Code was found.
ZC0220 - Return All ZIP Codes in a Given County Program ZC0220 will return all ZIP Codes found in a given county. The input is the county name and state name. If a match is found, the ZIP Codes will be returned as part of a six-hundred element array.
ZC0230 - Determine if a City Has Only One ZIP Code Program ZC0230 allows you to determine if a city has only one ZIP Code. The only input is the ZIP Code. A one-position parameter is retuned with the result. If the parameter contains a "Y," then the city has only a single ZIP Code. If the parameter is not blank, the city has been assigned more than one ZIP Code.
ZC0240 - Return the Full State Name Based on the State Abbreviation Program ZC0240 will provide the fully spelled-out state name when given the state abbreviation. No screen is used. The input is the two-position state abbreviation, the output is the state FIPS code and the full state name. Also, another input parameter allows you to specify if the state name is to be returned in all uppercase or mixed case.
ZC0300 - Return a ZIP Code When Given the City Name Program ZC0300 will return a single ZIP Code when given a valid city and state name. No screen is used. If the city has more that one ZIP Code, the lowest one will be returned. Generally this program should be used only to get you started on a ZIP Code search, since it is not good for use in cases where a city has many ZIP Codes.
ZC0310 - Return all ZIP Codes When Given a City Name Program ZC0310 will return all ZIP Codes for a given city. Up to 300 ZIP Codes will be returned in an array. No screen is used. The input is the city name and the state code. If a match is found, the array will be returned containing the ZIP Codes. If no match is found, the array will be returned empty.
NDL007 - Return the Nearest Dealers Program NDL007 allows you to determine the 10 nearest dealers based on the average latitude/longitude of the specified dealer. No screen is used. The purpose of this program is to allow you to identify the dealers nearest to an inquiring customer. The only input is the customer's ZIP Code. The program will return the dealer number and matching distance for the ten nearest dealers. Program NDL006 performs the same funtion except that it returns only the three nearest dealers.
AC0010 - Return the State for a Given Area Code The only input to this program is the area code. No screen is used. One or two state codes and one or two time zones will be returned. The second state and time zone will be returned only if the area code spans two states or two time zones.