Here's the new code I wrote. I based it on the example in:

http://script.quakenet.org/wiki/Why_and_how_to_use_File_Handlers#Reading_from_the_Stream

I think this will work OK, no? I also assume that %readline will be able to be used by the calling alias, right?

Please let me know if/what I messed up! I wasn't sure how to pass the filename into the checkspotforcounty alias, and how to check its return value in an if () {} statement.


alias checkspotforcounty {

set %filename $$1

if (!$isfile(%filename)) { return $false }
if ($fopen(specialneeds)) { .fclose specialneeds }
.fopen specialneeds %filename

while (!$fopen(specialneeds).eof) {

set %readline $fread(specialneeds)

set %county $left(%readline,-4)
set %state $right(%readline,4)
if ( ( %county isin %spotline ) &&
( %state isin %spotline ) ) {
unset %state %county %filename
.fclose specialneeds
return $true
}
}

unset %state %county %filename
.fclose specialneeds
return $false
}


alias checkneeds {
if $readini(cht.ini, options, needdisable) = 1 { return }

# I need %filename later which is why it's set here
set %filename specialneeds.txt

if ( (checkspotforcounty %filename) == $false ) {
unset %filename %readline
return
}

... etc.


Jim Reisert
http://www.ad1c.us/