A great technique we got from Bill Pitts was to use a list for valid (or invalid) values and then a list lcontain command to do the filtering.
Near the top you setup your list of locations. Here it is used for message types, but you can use the same technique for locations:
# Set Not Allowed Events List
set HL7EventsNotAllowed {A17 A31 A34 A35 A60 Z08}
And then in the logic portion, after you have parsed the field you want to test, you use a list command to see if the current value is in the list:
# KILL message if MSH9_2 Event is in Not Allowed HL7 Event List
if {[lcontain $HL7EventsNotAllowed $MSH9_2]} {
if {$debug} {echo “$debugout KILL msg event $MSH9_2 not allowed”}
lappend dispList “KILL $mh”
}