Understanding Debug and ILE RPG compile options

Compiling ILE RPG programs with different debugging view options can make a big difference. Understanding these options can make debugging ILE RPG a breeze.

Debugging View:
  • No copy (/CPY) included in debug source view
  • No watch variables
  • File I/O causes debug to stop on file specifications
  • Same as *SOURCE except copy (/CPY) statements can be viewed.
  • Copy source allow can be viewed
  • Watch variable can be used
  • File I/O will not stop on file specifications. Rather the source lines continue after the file (READ, CHAIN, READP, etc.)

  • Simliar to *LIST but also depends on the parameters set in the Compiler options (OPTION) field.

Another method to prevent your debug session from stepping through file I/O is to specify *NODEBUGIO on an H specification in your program. It is also best to specify *SRCSTMT to match the debug output with the actual source code. In other words, *SRCSTMT will deny the compiler the right to renumber source lines.


Conclusion: Compiler default debugging view should be set to *LIST or *ALL (in a developer's environment). Compiler options entered on H-specs will override whatever parameters are used when compiling the program. The compiler defaults can be overridden by entering options on the header (H spec) of the RPG program.  Be aware that optimizing programs can affect your debug results.  With an Optimize setting of Full, 30, or 40 the field values may not be current!