Your first step should be to remove the $com() call from the /if statement, and assign its result to a variable, eg. var %result = $com(). You can then /echo result: %result comerr: $comerr afer the $com() call to see whether it is succeeding or failing. If the value returned by $com() is 1, this means that the call succeeded.