Validates the presence of data for specified states in the GSD data file.
Syntax
GsFunStat GsVerifyGSDDataPresent (GsId gs, GsStateList
states)
Arguments
GsIdgs ID returned by GsInitWithProps() for the current instance of GeoStan. Input.
GsStateListstates Structure containing state abbreviations and/or FIPS codes. Input.
Return Values
GS_SUCCESS All states or FIPS codes specified in states are present in GSD data.
GS_GSD_DATA_MISSING One or more states or FIPS codes specified in states are not present in GSD data.
GS_ERROR states structure is invalid.
Prerequisites
You must create a valid GsId with a call to GsInitWithProps().
If GeoStan did not find the GSD primary data for all the specified states, this function creates an error in the error list retrievable using GSErrorGetEx. The error message code is 114 and the error message is "NO GSD DATA FOUND FOR STATE" and indicates which states GeoStan did not find.
The state abbreviations and corresponding state FIPS codes are as follows:
State |
Abbrev. |
FIPSCodea |
State |
Abbrev. |
FIPSCodea |
---|---|---|---|---|---|
Alabama |
AL |
1 |
New Jersey |
NJ |
34 |
Alaska |
AK |
2 |
New Mexico |
NM |
35 |
Arizona |
AZ |
4 |
New York |
NY |
36 |
Arkansas |
AR |
5 |
North Carolina |
NC |
37 |
California |
CA |
6 |
North Dakota |
ND |
38 |
Colorado |
CO |
8 |
Ohio |
OH |
39 |
Connecticut |
CT |
9 |
Oklahoma |
OK |
40 |
Delaware |
DE |
10 |
Oregon |
OR |
41 |
District of Columbia |
DC |
11 |
Pennsylvania |
PA |
42 |
Florida |
FL |
12 |
Rhode Island |
RI |
44 |
Georgia |
GA |
13 |
South Carolina |
SC |
45 |
Hawaii |
HI |
15 |
South Dakota |
SD |
46 |
Idaho |
ID |
16 |
Tennessee |
TN |
47 |
Illinois |
IL |
17 |
Texas |
TX |
48 |
Indiana |
IN |
18 |
Utah |
UT |
49 |
Iowa |
IA |
19 |
Vermont |
VT |
50 |
Kansas |
KS |
20 |
Virginia |
VA |
51 |
Kentucky |
KY |
21 |
Washington |
WA |
53 |
Louisiana |
LA |
22 |
West Virginia |
WV |
54 |
Maine |
ME |
23 |
Wisconsin |
WI |
55 |
Maryland |
MD |
24 |
Wyoming |
WY |
56 |
Massachusetts |
MA |
25 |
American Samoa |
AS |
60 |
Michigan |
MI |
26 |
Guam |
GU |
66 |
Minnesota |
MN |
27 |
North Mariana Islands |
MP |
69 |
Mississippi |
MS |
28 |
Palau |
PW |
70 |
Missouri |
MO |
29 |
Puerto Rico |
PR |
72 |
Montana |
MT |
30 |
Virgin Islands |
VI |
78 |
Nebraska |
NE |
31 |
|||
Nevada |
NV |
32 |
|||
New Hampshire |
NH |
33 |
a: Do not specify Minor Islands (UM, 74) or you will receive an error. This is defined as a FIPS code, but the USPS does not generate data for this code. |
The following pseudo FIPS codes support APO and FPO addresses:
Address |
Abbrev. |
FIPS Code |
---|---|---|
Armed Forces Europe |
AE |
57 |
Armed Forces Pacific |
AP |
58 |
Armed Forces Americas |
AA |
59 |
GsVerifyGSDDataPresent() uses the GsStateList structure to pass in a list of state abbreviations or state FIPS codes to verify their presence in the GSD data. This structure contains the following:
typedef struct GsStateList
{
char *state[100]; /* array of 2 char null terminated strings */
int cnt; /* entries in 'state' that are filled in */
}
GsStateList;
Example
typedef struct GsStateList
{
char state[100][3]; /* array of 2 char null terminated strings */
int cnt; /* entries in 'state' that are filled in */
}
GsStateList;
GsStateList states;
char error_buffer[256];
char details_buffer[256];
/* populate states structure with all states that are required to be in the GSD data in order
to create a CASS report */
/* Note: Test for CASS required GSD data is not a fatal error so the 'error' flag is not set */
states.cnt = 0;
strcpy(states.state[states.cnt++], "AL");
strcpy(states.state[states.cnt++], "AK");
strcpy(states.state[states.cnt++], "AZ");
/* additional states can be copied into the array here */
....
strcpy(states.state[states.cnt++], "AA");
if (GsVerifyGSDDataPresent(process->gs, states) == GS_SUCCESS)
process->hasCASSRequiredData = 1;
else
{
process->hasCASSRequiredData = 0;
while ( GsErrorHas(process->gs))
GsErrorGetEx (process->gs, error_buffer, details_buffer);
printf ( "%s: %s\n", error_buffer, details_buffer ); /* report the errors */
}