The DEBUG Keyword
The more well-known function of the DEBUG keyword, as used in an H-spec, is to control whether DUMP operations are performed or not. But the other function that the DEBUG keyword controls is whether or not unused fields from externally described files are moved from the file buffer. You may be asking yourself what this has to do with debugging. The answer is that if fields are not moved from the buffer, the values are not available during debugging. For instance, if you're using DEBUG(*NO), which is the default, then only fields that are referred to in the program code will be accessible when you're debugging. Contrariwise, if you use DEBUG(*YES), all the file fields will be accessible, regardless of whether they are referred to in the code.
Compiler OPTION Keyword
For now, we will speak specifically about using CRTBNDRPG or CRTRPGMOD. Several keywords used in these commands control debugging options. First, the OPTION keyword can be used to control whether breakpoints are generated for input and output specifications by using *DEBUGIO or *NODEBUGIO. I have found that using *DEBUGIO to generate breakpoints for I/O specifications is rarely useful, so I always use *NODEBUGIO.
Compiler OPTIMIZE Keyword
Again, you might ask what the OPTIMIZE keyword has to do with debugging. The answer is that the level of optimization affects whether variables can be modified and/or whether the displayed values are the current values. Using OPTIMIZE(*BASIC) will allow variables to be displayed but not modified in debug mode. While using OPTIMIZE(*FULL), variables cannot be modified, and values displayed for interrogated variables may not reflect the current values.
Compiler DBGVIEW Keyword
This is perhaps the most well-known of the compiler keywords that affect debugging. There are six options, and there's not room here to cover all of them. So I recommend that you check the iSeries Information Center and find out the details for yourself. For my part, I always use DBGVIEW(*ALL).
Also, when compiling an RPG ILE program that uses SQL (using CRTSQLRPG), there are only two options, either *SOURCE or *NONE. The functioning of *NONE should be clear enough. However, using the *SOURCE option will cause DBGVIEW(*ALL) to be used in the subsequent CRTRPGMOD and/or CRTBNDRPG commands.
Happy hunting.
Jeff Olen is an analyst in the IS department at Costco Wholesale in Issaquah, Washington (just outside Seattle). He has nearly 20 years of experience on midrange systems and has developed software for a wide range of applications. He may be reached at
LATEST COMMENTS
MC Press Online