The errors that Doc displayed were the result of passing your script through the Sanity() udf, which checks for mismatched quotes & parens, undeclared vars or duplicate var definitions. Sanity is also part of the KGen tools.

Sanity also generates a report of variable usage, so you can easily add var declarations in each UDF.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D