Techniques for debugging programs in TSO

Documenting the errors that are identified during testing of a TSO application helps you investigate and correct problems in the program.

The following information can be useful:
  • The application plan name of the program
  • The input data that is being processed
  • The failing SQL statement and its function
  • The contents of the SQLCA (SQL communication area) and, if your program accepts dynamic SQL statements, the SQLDA (SQL descriptor area)
  • The date and time of day
  • The abend code and any error messages

When your program encounters an error that does not result in an abend, it can pass all the required error information to a standard error routine. Online programs might also send an error message to the terminal.

The TSO TEST command

The TSO TEST command is especially useful for debugging assembler programs.

The following example is a command procedure (CLIST) that runs a Db2 application named MYPROG under TSO TEST, and sets an address stop at the entry to the program. The Db2 subsystem name in this example is DB4.

PROC 0
TEST 'prefix.SDSNLOAD(DSN)' CP
DSN SYSTEM(DB4)
AT MYPROG.MYPROG.+0 DEFER
GO
RUN  PROGRAM(MYPROG)  LIBRARY('L186331.RUNLIB.LOAD(MYPROG)')