Creating a Program for Source Debugging

In this example you create the program EMPRPT so that you can debug it using the source debugger. The DBGVIEW parameter on either CRTBNDRPG or CRTRPGMOD determines what type of debug data is created during compilation. The parameter provides six options which allow you to select which view(s) you want:

The source for EMPRPT is shown in Figure 28.

  1. To create the object type:
    CRTBNDRPG PGM(MYLIB/EMPRPT) DBGVIEW(*SOURCE) DFTACTGRP(*NO)

    The program will be created in the library MYLIB with the same name as the source member on which it is based, namely, EMPRPT. Note that by default, it will run in the default named activation group, QILE. This program object can be debugged using a source view.

  2. To debug the program type:
    STRDBG EMPRPT

    Figure 32 shows the screen which appears after entering the above command.

    Figure 32. Display Module Source display for EMPRPT
                                 Display Module Source
     Program:   EMPRPT         Library:   MYLIB          Module:   EMPRPT
          1        *==============================================================*
          2        * MODULE NAME:    EMPRPT
          3        * RELATED FILES:  EMPMST   (PHYSICAL FILE)
          4        *                 QSYSPRT  (PRINTER FILE)
          5        * DESCRIPTION:    This program prints employee information
          6        *                 from the file EMPMST.
          7        *==============================================================*
          8       FQSYSPRT   O    F   80        PRINTER
          9       FEMPMST    IP   E           K DISK
         10
         11       D TYPE            S              8A
         12       D EMPTYPE         PR             8A
         13       D   CODE                         1A
         14
         15       IEMPREC        01
                                                                            More...
     Debug . . .   _________________________________________________________________
    _______________________________________________________________________________
     F3=End program   F6=Add/Clear breakpoint   F10=Step   F11=Display variable
     F12=Resume       F17=Watch variable   F18=Work with watch   F24=More keys

    From this screen (the Display Module Source display) you can enter debug commands to display or change field values and set breakpoints to control program flow while debugging.

For more information on debugging see Debugging Programs.



[ Top of Page | Previous Page | Next Page | Contents | Index ]