How do I debug an Input Script?

If an Input script is not working, the first question to ask would be: If I were to do these steps in standard SAP with same data, what would happen?

Turn on Input script Trace from Options->Trace auto processing on GuiXT window. The trace window will show execution steps of an input script. This trace also outputs the values of GuiXT variables.

Turn on visible auto processing from Options->Visible auto processing. Now, any input script will run in a single step mode. GuiXT will process the screen block and wait for Enter to be pressed by user to execute Enter "XXX" command.