Unfortunately, using this method to display data contained in a particular occurrence of a multiple occurrence data structure has a limitation. If you use the F11 key, the debugger displays only the value of the current occurrence. Fortunately, the debugger's built-in %INDEX function solves this problem by letting you set the current index of a multiple occurrence data structure.
You use the %INDEX function through the EVAL statement. For example, if you want to look at the thirteenth occurrence of data structure MODS, you key the following debug command in the debugger command line:
EVAL MODS = %INDEX(13)
Now you can display the value of the thirteenth occurrence by either placing the cursor in the MODS variable and pressing F11 or using the EVAL command. You can also display any of the subfields of the data structure with the F11 technique or with the EVAL command.
There are two other built-in debug functions to assist you in displaying variables: %SUBSTR and %ADDR. The %SUBSTR function allows you to substring a character string variable. Similar to the ILE RPG %SUBSTR operator, the first parameter is the variable name, the second parameter is the starting position, and the third parameter is the number of bytes to display. For example, to display 25 bytes of a variable named LONGSTR beginning with position 1001, you would enter the following debug command:
EVAL %SUBSTR(LONGSTR 1001 25)
The %ADDR function displays the memory address of a variable. To display the address of example variable LONGSTR, you would enter the following debug command:
For more information about the new system debugger, see "The ILE Source Debugger" (MC, March 1995) or the ILE RPG/400 Programmer's Guide (SC09-1525, QBKAQDOO).
- Richard Shaler
MC Press Online