Monday, January 14, 2008

Debug does not show values for all fields in the file:

Ex: Consider an RPG IV program that reads a physical file Customer and prints a report. This report uses 4 fields out of 20 fields from the Customer file. The remaining fields are not referenced in the program. Put this program in Debug. Place a break point in the program immediately after reading a record from the file Customer. Now try to display the value of the fields the file contains. Several of the fields appear as blank. The record did indeed contain data in the fields reported as blank by the debugger.

The debugger is not showing the value for the fields because the information is not available to the debugger.

The RPG compiler optimizes unreferenced fields out of the program. In other words, any field in the file Customer that is not specifically referenced by an RPG operation is not included in the program.

To make the unreferenced fields available to the debugger include an H-Spec with keyword Debug as shown below. This prevents the compiler from optimizing out unreferenced fields.

H DEBUG

No comments: