Report question

Question: How to capture exit code when using open/print to execute a SQL statement?