15500 !-------------------------------------------------------------------- & ! & ! Function to check a zip code & ! & !-------------------------------------------------------------------- & ! & ! input: ADD.ZIP$ zip.code & ! ALL.SP% code for remove all spaces & ! & ! output: ZIP$ zip code with spaces removed & ! LEN.ZIP% length of the compacted zip & ! & ! local: BAD% flag to indicate if zip code is invalid & ! & !-------------------------------------------------------------------- & 15510 DEF FN.BAD.ZIP% & 15520 BAD% = FALSE% & \ ZIP$ = EDIT$ (ADD.ZIP$, ALL.SP%) & \ LEN.ZIP% = LEN (ZIP$) & ! Initialize the flag, and compact the zip. & 15530 BAD% = TRUE% & IF (LEN.ZIP% <> 5% AND LEN.ZIP% <> 10%) & OR ZIP$ = "00000" & OR POS ("0123456789", ADD.ZIP.NUM$(I%),1%) = 0% FOR I% = 0% TO 4% & \ GO TO 15590 IF LEN.ZIP% = 5% & & \ BAD% = TRUE% & IF ADD.ZIP.NUM$(5%) <> "-" & OR ZIP$ = "00000-0000" & OR POS ("0123456789", ADD.ZIP.NUM$(I%),1%) = 0% FOR I% = 6% TO 9% & ! Check all the ways that the zip code can be invalid. & 15590 FN.BAD.ZIP% = BAD% & \ FNEND & ! Set function value. &