Superior Software and Service for the IBM AS/400, iSeries and System i5

CPC CALLABLE PROGRAMS

Integrating ZIP/CITY into your application programs

Integrating CPC into your application programs
Integrating CPC 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 file QSAMPLESRC in library CPCLIB. All of these programs are called in typical iSeries or AS/400 fashion. A call to the program is followed by a parameter list.

The data in the CPC files is encrypted and cannot be accessed directly by your application program. Our programs automatically unencrypt the data. Here is a summary of the callable programs (or API’s, Application Program Interfaces.)

CPC020 – Calculate the Distance between Two Postal Codes
Program CPC020 calculates the air-line distance between two postal codes. No screen is used. The input is two valid postal codes and the air-line distance is returned in miles and in kilometers.

CPC104 – Return All Information for a Postal Code
Program CPC104 uses no screen. The only input is a postal code. All information that is available in CPC for that postal code is returned. Up to 10 city names are returned along with the province abbreviation, area code, time zone, lat/lon, a daylight savings time indicator, and a flag that indicates if the city involved has only one postal code. The city name and province name can be returned in mixed case or all upper case. CPC104 is the program most users will want to integrate into their data entry programs. It can greatly simplify error checking and reduce keystrokes and data entry errors.

CPC108 – Match an address to the address database
CPC108 allows you to match a single address to the address database to determine the correct postal code. Either parsed or string address information can be used. Address elements are submitted as program parameters.

CPC110 – Return All Postal Codes for a Given City
Program CPC110 uses no screen. The only input is a city name and province code. All postal codes for that city will be returned in an array. Because the number of postal codes can be quite large, two arrays of 9,999 positions are used to return the postal codes. During testing we discovered that Toronto, ON, has over 13,000 postal codes. The response time when using CPC110 will be strictly dependent on the number of postal codes within a city. Cities with only a few postal codes will complete instantly, while Toronto and other very large cities will require much more time.

CPC130 – Select a Province Name
Program CPC130 displays a province list. You can select the desired province and the province code and name will be returned to the calling program. The province name can be returned in mixed case or all upper case.

CPC140 – Select a Postal Code from City/Province list
Program CPC140 displays a postal code list with matching cities. You can select the desired postal code from the list. All information for the selected postal code will be returned.

CPC200RN – Browse the Postal Code File
Program CPC200RN allows you to browse the postal code file. This is the same feature provided by option one on the CPC main menu.

CPC407 – Return the Nearest Dealers
Program CPC407 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 postal code. The program will return the dealer number and distance for the ten nearest dealers.