-3 means file handle is already in use ... try changing this line:

IF Open(1,"c:\templog.txt")

to this:

IF Open(10,"c:\templog.txt")

use file handle 10.

-Shawn