DEBUG{(*DUMP | *INPUT | *RETVAL | *XMLSAX | *NO | *YES)}

The DEBUG keyword controls what debugging aids are generated into the module.

When the DEBUG keyword is specified with one or more of the *CONSTANTS, *DUMP, *INPUT, *RETVAL, or *XMLSAX parameters, you can choose exactly which debugging aids are to be generated into the module.

When the DEBUG keyword is specified with *YES or *NO, no other parameters can be specified.
  • With DEBUG(*YES), the *DUMP and *INPUT options are available. Specifying DEBUG(*YES) is the same as specifying DEBUG(*DUMP:*INPUT).
  • With DEBUG(*NO), none of the debug options are available.

The following options can be specified individually:

*CONSTANTS
You can view the value of named constants in the debugger.
*DUMP
DUMP operations are performed.

Note: You can force a DUMP operation to be performned by specifying operation extender A on the DEBUG operation code. This operation extender means that a dump is always performed, regardless of the value of the DEBUG keyword.

*INPUT
All externally described input fields will be read during input operations even if they are not used in the program. Normally, externally described input fields are only read during input operations if the field is otherwise used within the program.
*RETVAL
If a procedure returns a value, you can set a breakpoint on the last statement of the procedure to view or change the return value by evaluating the special variable _QRNU_RETVAL.
  • In free-form code, set the breakpoint on the END-PROC statement.
  • In fixed-form code, set the breakpoint on the Procedure-End specification.
_QRNU_RETVAL is defined the same as the return value from the procedure.
  • If the return value is a data structure, _QRNU_RETVAL is also a data structure.
    For example, if the return value is defined with keyword LIKEDS(myDs), and myDs has subfields id and addr:
    • You can display the entire data structure
      EVAL _QRNU_RETVAL
    • You can display or change individual subfields
      
      EVAL _QRNU_RETVAL.addr
      EVAL _QRNU_RETVAL.id = 12345
      
  • If the return value is an array, _QRNU_RETVAL is an array. For example, if the return value is defined with keyword DIM(5):
    • You can display the entire array
      EVAL _QRNU_RETVAL
    • You can display or change individual elements
      
      EVAL _QRNU_RETVAL(1)
      EVAL _QRNU_RETVAL(2) = 25.3
      
*XMLSAX
An array with the name _QRNU_XMLSAX will be generated into the module if it has a debug view (if it is compiled with a value for the DBGVIEW parameter other than *NONE). The values of the array will be the names of the *XML special words, without the "*XML_" prefix. For example, if *XML_START_DOCUMENT has the value 1, _QRNU_XMLSAX(1) will have the value "START_DOCUMENT".
Sample debug session:
> EVAL event
  EVENT = 2
> EVAL _QRNU_XMLSAX(event)
  _QRNU_XMLSAX(EVENT) = 'END_DOCUMENT   '

Specifying the DEBUG keyword with *NO indicates that no debugging aids should be generated into the module. This is the same as omitting the DEBUG keyword entirely. No other parameters can be specified when *NO is specified.

Specifying the DEBUG keyword with *YES or with no parameters is the same as specifying DEBUG(*INPUT : *DUMP). No other parameters can be specified when *YES is specified. The value *YES is retained for compatibility; it is preferable to specify the more granular values *INPUT, *DUMP and *XMLSAX.

Examples:
  * 1. All of the debugging aids are available
 H DEBUG(*CONSTANTS : *INPUT : *DUMP : *RETVAL : *XMLSAX)
* 2. None of the debugging aids are available
 H DEBUG(*NO)
* 3. Only the debugging aid related to input fields is available
 H DEBUG(*INPUT)
* 4. The debugging aids related to the DUMP operation and
*    to XML-SAX parsing are available
 H DEBUG(*XMLSAX : *DUMP)
Note: The DEBUG keyword does not control whether the module is created to be debuggable. That is controlled by the DBGVIEW parameter for the CRTBNDRPG or CRTRPGMOD command. The DEBUG keyword controls additional debugging aids.