Do you undertand why it's happening? I'm guessing not, otherwise your questions might be a bit different..

Some "programming 101" -

There are two basic classes of program operation, a Command and a Function. In the most simple form, a command simply does something - with or without an argument - but doesn't return any information. Often, it won't even return a success/fail result.

Functions, on the other hand, can return two types of information - a Return Value and an Exit Status. The "Exit Status" indicates the "quality" of the function's performance - did it succeed (exit 0) or fail (exit ERROR_CODE). This can be checked in Kix via the @ERROR macro, which contains the function's exit code, and @SERROR, which contains the text representation of the error code.

The "Return Value" is what you are seeing on the screen. Many Kix functions mirror the Exit Status in the Return Value, so the "0" being returned indicates that the function was successful. Thus, most functions should be used with the form
 Code:
$ReturnCode = Function(arg)
Often, the return code is not really needed, but you don't want to "litter" and just drop the value on the console screen floor, so you will see something like
 Code:
$Rc = Function(arg)
fairly often, with no further reference to the $Rc value. This format simply "catches" the Return Value, kind of like a programmatic trash can. ;\)

Scan your code. Every time you see a function(), see if there's a variable to catch the return value. If there isn't, use $Rc (commonly used to ignore a Return Code) to catch the return code and see if your litter gets cleaned up.

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