IBM Support

The debugger steps to the wrong statement when debugging an ILE RPG program compiled with OPTION(*SRCSTMT)

Troubleshooting


Problem

When debugging an ILE RPG program compiled with OPTION(*SRCSTMT), the debugger seems to step to the wrong statement.

Cause

This issue is caused by duplicate sequence numbers in the source used for the final stage of the compile. With OPTION(*SRCSTMT), the statement numbers are derived from the sequence numbers of the source. If there are duplicate sequence numbers in the source, there are duplicate statement numbers in the module. When a Step is done in the debugger, the debugger may choose to show a different source line with the statement number that the program steps to.
This most commonly occurs when the compilation was done using the CRTSQLRPGI command, with the default OPTION(*NOSEQSRC), when there are debuggable statements in a /COPY file. OPTION(*NOSEQSRC) says to copy the sequence numbers from the original source into the generated source file. If a debuggable statement in a /COPY file has the same sequence number as a debuggable statement in the main source file or another /COPY file, the statements will have the same statement number.
 

Resolving The Problem

Do one of the following:
  • Specify OPTION(*SEQSRC) for the CRTSQLRPGI command
  • Specify OPTION(*NOSRCSTMT) in a Control statement of the SQLRPGLE source

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SS69QP","label":"Rational Development Studio for i"},"ARM Category":[{"code":"a8m0z0000000C4BAAU","label":"IBM i"},{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Document Information

Modified date:
24 September 2021

UID

ibm16492599