Creating a Statement View

A statement view allows the module object to be debugged using statement numbers and the debug commands. Since the source will not be displayed, you must make use of statement numbers which are shown in the source section of the compiler listing. In other words, to effectively use this view, you will need a compiler listing. In addition, the statement numbers generated for debugging are dependent on whether *SRCSTMT or *NOSRCSTMT is specified for the OPTION parameter. *NOSRCSTMT means that statement numbers are assigned sequentially and are displayed as Line Numbers on the left-most column of the source section of the compiler listing. *SRCSTMT allows you to request that the compiler use SEU sequence numbers and source IDs when generating statement numbers for debugging. The Statement Numbers are shown on the right-most column of the source section of the compiler listing.

You create a statement view to debug a module by using the *STMT option on the DBGVIEW parameter for either the CRTRPGMOD or CRTBNDRPG commands when you create a module.

Use this view when:
  • You have storage constraints, but do not want to recompile the module or program if you need to debug it.
  • You are sending compiled objects to other users and want to be able to diagnose problems in your code using the , but you do not want these users to see your actual code.
For example, to create a statement view for the program DEBUGEX using CRTBNDRPG, type:
CRTBNDRPG PGM(MYLIB⁄DEBUGEX) SRCFILE(MYLIB⁄QRPGLESRC)
          TEXT('ILE RPG⁄400 program DEBUGEX')
To create a statement view for a module using CRTRPGMOD, type:
CRTRPGMOD MODULE(MYLIB⁄DBGEX) SRCFILE(MYLIB⁄QRPGLESRC)
          TEXT('Entry module for program DEBUGEX')

By default a compiler listing and a statement view are produced. Using a compiler listing to obtain the statement numbers, you debug the program using the debug commands.

If the default values for either create command have been changed, you must explicitly specify DBGVIEW(*STMT) and OUTPUT(*PRINT).