Testing X12 270/271 N4: The Fields Your System Actually Needs to Handle
N4 always follows N3 and finishes the address that N3 started. Skip validating it on its own and you end up with test data that has a perfectly formed street line attached to a ZIP code that doesn't belong to the state next to it.
N4 (Geographic Location) is the segment in an X12 271 eligibility response that carries the city, state, and postal code for the party described by the preceding N3 segment. Three elements do the work: N401, N402, and N403.
The elements that actually matter in practice
Example
N401 = Bellhaven, N402 = OH, N403 = 43215 — a complete city-state-ZIP combination following an N3 street line. Synthetic 271 response data.
Where this trips people up
N4 places no hard constraint linking N402 and N403 to each other, so nothing in the segment itself stops a payer's system — or a hand-built test file — from pairing a real ZIP code with the wrong state abbreviation. Systems that only check each element's format in isolation will pass files where the geography simply doesn't line up, and that error usually surfaces later as a failed downstream address-validation call rather than at EDI parse time.