Your application sounds pretty interesting. The Behavior of "exit()" is puzzeling. Both Exit() and Quit() terminate the exitsting JMP session without returning anything unless there are tables that are open and unsaved. Then in that case you will see a dialog window to save, cancel, etc..
if "exit()" is commented out, does the script still return a numeric value?
JMP Systems Engineer, Health and Life Sciences (Pharma)