DBGVIEW parameter - IBM - RPG

A program or module must have debug data available if you are to debug it. Since debug data is created during compilation, you specify whether a module is to contain debug data when you create it using CRTBNDRPG or CRTRPGMOD. You use the DBGVIEW parameter on either of these commands to indicate what type of data (if any) is to be created during compilation.

The type of debug data that can be associated with a module is referred to as a debug view. You can create one of the following views for each module that you want to debug. They are:

  • Root source view
  • COPY source view
  • Listing view
  • Statement view

The default value for both CRTBNDRPG and CRTRPGMOD is to create a statement view. This view provides the closest level of debug support to previous releases. If you do not want debug data to be included with the module or if you want faster compilation time, specify DBGVIEW(*NONE) when the module is created. However, a formatted dump will not list the values of program variables when no debug data is available. Note also that the storage requirements for a module or program will vary somewhat depending on the type of debug data included with it. The following values for the DBGVIEW parameter are listed in increasing order based on their effect on secondary storage requirements:

  1. *NONE
  2. *STMT
  3. *SOURCE
  4. *COPY
  5. *LIST
  6. *ALL

Once you have created a module with debug data and bound it into a program object (*PGM), you can start to debug your program.

Note: An OPM program must be compiled with OPTION(*SRCDBG) or OPTION(*LSTDBG) in order to debug it using the ILE source debugger.

Debug Views

Debug Views

Creating a Root Source View
A root source view contains text from the root source member. This view does not contain any /COPY members. Furthermore, it is not available if the root source member is a DDM file.

You create a root source view to debug a module by using the *SOURCE, *COPY or *ALL options on the DBGVIEW parameter for either the CRTRPGMOD or CRTBNDRPG commands when you create the module.

The compiler creates the root source view while the module object (*MODULE) is being compiled. The root source view is created using references to locations of text in the root source member rather than copying the text of the member into the module object. For this reason, you should not modify, rename, or move root source members between the module creation of these members and the debugging of the module created from these members. If you do, the views for these source members may not be usable.

For example, to create a root source view for a program DEBUGEX when using CRTBNDRPG, type:

To create a root source view for a module DBGEX when using CRTRPGMOD, type:

Specifying DBGVIEW(*SOURCE) with either create command creates a root source view for debugging module DBGEX. By default, a compiler listing with /COPY members and expanded DDS, as well as other additional information is produced.

Creating a COPY Source View
A COPY source view contains text from the root source member, as well as the text of all /COPY members expanded into the text of the source. When you use the COPY view, you can debug the root source member of the program using the root source view and the /COPY members of the program using the COPY source view.

The view of the root source member generated by DBGVIEW(*COPY) is the same view generated by DBGVIEW(*SOURCE). As with the root source view, a COPY source view is not available if the source file is a DDM file.

You create a COPY source view to debug a module by using the *COPY or *ALL option on the DBGVIEW parameter.

The compiler creates the COPY view while the module object (*MODULE) is being compiled. The COPY view is created using references to locations of text in the source members (both root source member and /COPY members) rather than copying the text of the members into the view. For this reason, you should not modify, rename, or move source members between the time the module object is created and the debugging of the module created from these members. If you do, the views for these source members may not be usable.

For example, to create a source view of a program TEST1 that contains /COPY members type:

Specifying DBGVIEW(*COPY) with either create command creates a root source view with /COPY members for debugging module TEST1. By default, a compiler listing is produced. The compiler listing will include /COPY members as well, since OPTION(*SHOWCPY) is a default value.

Creating a Listing View
A listing view contains text similar to the text in the compiler listing that is produced by the ILE RPG compiler. The information contained in the listing view is dependent on whether OPTION(*SHOWCPY), OPTION(*EXPDDS), and OPTION(*SRCSTMT) are specified for either create command. OPTION(*SHOWCPY) includes /COPY members in the listing; OPTION(*EXPDDS) includes externally described files. OPTION(*SRCSTMT) allows the program object to be debugged using the Statement Numbers instead of the Line Numbers of the compiler listing.

Note: Some information that is available in the compiler listing will not appear on the listing view. For example, if you specify indentation in the compiler listing (via the INDENT parameter), the indentation will not appear in the listing view. If you specify OPTION(*SHOWSKP) in the compiler listing, the skipped statements will not appear in the listing view.

You create a listing view to debug a module by using the *LIST or *ALL options on the DBGVIEW parameter for either the CRTRPGMOD or CRTBNDRPG commands when you create a module.

The compiler creates the listing view while the module object (*MODULE) is being generated. The listing view is created by copying the text of the appropriate source members into the module object. There is no dependency on the source members upon which it is based, once the listing view is created.

For example, to create a listing view for a program TEST1 that contains expanded DDS type:

Specifying DBGVIEW(*LIST) for the DBGVIEW parameter and *EXPDDS for the OPTION parameter on either create command creates a listing view with expanded DDS for debugging the source for TEST1. Note that OUTPUT(*PRINT) and OPTION(*EXPDDS) are both default values.

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 debugger, 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:

To create a statement view for a module using CRTRPGMOD, type:

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


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

IBM - RPG Topics