To clarify the output issue. The UDF is not supposed to create any output except a (single) return value/error code.
_________________________
There are two types of vessels, submarines and targets.