You can change the module object that is shown on the Display Module Source display by using option 5 (Display module source) on the Work with Module List display. The Work with Module List display can be accessed from the Display Module Source display by pressing F14 (Work with Module List). The Display Module Source display is shown in Figure 10-5.
To select a module object, type 5 (Display module source) next to the module object you want to show.
Figure 10-5. Display a Module View
+--------------------------------------------------------------------------------+
| Display Module Source |
| |
| Program: DSPWKDAY Library: MYLIB Module: DSPWKDAY |
| 24 500- CALL PGM(WEEKDAY2) PARM(&DAYOFWK) |
| 25 600- IF COND(&DAYOFWK *EQ 1) THEN(CHGVAR + |
| 26 700 VAR(&WEEKDAY) VALUE('Sunday')) |
| 27 800- ELSE CMD(IF COND(&DAYOFWK *EQ 2) THEN(CHGV |
| 28 900 VAR(&WEEKDAY) VALUE('Monday'))) |
| 29 1000- ELSE CMD(IF COND(&DAYOFWK *EQ 3) THEN(CHGV |
| 30 1100 VAR(&WEEKDAY) VALUE('Tuesday'))) |
| 31 1200- ELSE CMD(IF COND(&DAYOFWK *EQ 4) THEN(CHGV |
| 32 1300 VAR(&WEEKDAY) VALUE('Wednesday'))) |
| 33 1400- ELSE CMD(IF COND(&DAYOFWK *EQ 5) THEN(CHGV |
| 34 1500 VAR(&WEEKDAY) VALUE('Thursday'))) |
| 35 1600- ELSE CMD(IF COND(&DAYOFWK *EQ 6) THEN(CHGV |
| 36 1700 VAR(&WEEKDAY) VALUE('Friday'))) |
| 37 1800- ELSE CMD(IF COND(&DAYOFWK *EQ 7) THEN(CHGV |
| 38 1900 VAR(&WEEKDAY) VALUE('Saturday'))) |
| More... |
| Debug . . . |
| |
| |
| F3=End program F6=Add/Clear breakpoint F10=step F11=Display variable |
| F12=Resume F17=Watch variable F18=Work with watch F24=More keys |
| |
+--------------------------------------------------------------------------------+
After you select the module object that you want to view, press Enter. The selected module object is shown in the Display Module Source display.
An alternate method of changing a module object is to use the DISPLAY debug command. On the debug command line, type:
DISPLAY MODULE module-name
The module object module-name will now be shown. The module object must exist in a program or service program object that has been added to the debug session.
Several views of an ILE CL module object are available depending on the values you specify when you create an ILE CL module object. These views are:
You can change the view of the module object that is shown on the Display Module Source display through the Select View display. The Select View display can be accessed from the Display Module Source display by pressing F15 (Select View). The Select View display is shown in Figure 10-6. The current view is listed at the top of the window, and the other views that are available are shown below. Each module object in a program object can have a different set of views available, depending on the debug options used to create it.
To select a view, type 1 (Select) next to the view you want to show.
Figure 10-6. Changing a View of a Module Object
+--------------------------------------------------------------------------------+
| Display Module Source |
| .............................................................................. |
| : Select View : |
| : : |
| : Current View . . . : CL Root Source : |
| : : |
| : Type option, press Enter. : |
| : 1=Select : |
| : : |
| : Opt View : |
| : CL Root Source : |
| : 1 CL Listing View : |
| : : |
| : : |
| : Bottom : |
| : F12=Cancel : |
| : : |
| :............................................................................: |
| More... |
| Debug . . . |
| |
| |
| F3=End Program F6=Add/Clear breakpoint F10=Step F11=Display variable |
| F12=Resume F17=Watch variable F18=Work with watch F24=More keys |
| |
+--------------------------------------------------------------------------------+
After you select the view of the module object that you want to show, press Enter and the selected view of the module object is shown in the Display Module Source display.
You can use breakpoints to halt a program object at a specific point when it is running. An unconditional breakpoint stops the program object at a specific statement. A conditional breakpoint stops the program object when a specific condition at a specific statement is met.
When the program object stops, the Display Module Source display is shown. The appropriate module object is shown with the source positioned at the line where the breakpoint occurred. This line is highlighted. At this point, you can evaluate variables, set more breakpoints, and run any of the debug commands.
You should know the following characteristics about breakpoints before using them:
These functions include:
You can set or remove an unconditional breakpoint by using:
The simplest way to set and remove an unconditional breakpoint is to use F6 (Add/Clear breakpoint) from the Display Module Source display. To set an unconditional breakpoint using F6, place your cursor on the line to which you want to add the breakpoint and press F6. An unconditional breakpoint is then set on the line. To remove an unconditional breakpoint, place your cursor on the line from which you want to remove the breakpoint and press F6. The breakpoint is then removed from the line.
Repeat the previous steps for each unconditional breakpoint you want to set.
After the breakpoints are set, press F3 (Exit) to leave the Display Module Source display. You can also use F21 (Command Line) from the Display Module Source display to call the program from a command line.
Call the program object. When a breakpoint is reached, the program stops and the Display Module Source display is shown again. At this point, you can evaluate variables, set more breakpoints, and run any of the debug commands.
An alternate method of setting and removing unconditional breakpoints is to use the BREAK and CLEAR debug commands.
To set an unconditional breakpoint by using the BREAK debug command, type:
BREAK line-number
on the debug command line. Line-number is the line number in the currently displayed view of the module object on which you want to set a breakpoint.
To remove an unconditional breakpoint by using the CLEAR debug command, type:
CLEAR line-number
on the debug command line. Line-number is the line number in the currently displayed view of the module object from which you want to remove a breakpoint.
If using the statement view, there is no line numbers displayed. To set unconditional breakpoints in the statement view, type:
BREAK procedure-name/statement-number
on the debug command line. Procedure-name is the name of your CL module. Statement-number(from the compiler listing) is the statement number where you wanted to stop.
You can set or remove a conditional breakpoint by using:
One way you can set or remove conditional breakpoints is through the Work with Module Breakpoints display. The Work with Module Breakpoints display can be accessed from the Display Module Source display by pressing F13 (Work with Module Breakpoints). The Work with Module Breakpoints display is shown in Figure 10-7. To set a conditional breakpoint, type the following:
and press Enter. For example, to set a conditional breakpoint at debugger line 35, as shown in Figure 10-7, type the following:
and press Enter.
To remove a conditional breakpoint, type 4 (Clear) in the Opt field next to the breakpoint you want to remove, and press Enter. You can also remove unconditional breakpoints in this manner.
Figure 10-7. Setting a Conditional Breakpoint
+--------------------------------------------------------------------------------+ | Work with Module Breakpoints | | System: SYSTEM01 | | Program . . . : MYPGM Library . . . : MYLIB | | Module . . . : MYMOD Type . . . . . : *PGM | | | | Type options, press Enter. | | 1=Add 4=Clear | | | | Opt Line Condition | | 1 35____ &I=21______________________ | | _ ______ ____________________________ | +--------------------------------------------------------------------------------+
Repeat the previous steps for each conditional breakpoint you want to set or remove.
After you specify all breakpoints that you want to set or remove, press F3 (Exit) to return to the Display Module Source display.
Then press F3 (Exit) to leave the Display Module Source display. You can also use F21 (Command Line) from the Display Module Source display to call the program object from a command line.
Call the program object. When a statement with a conditional breakpoint is reached, the conditional expression associated with the breakpoint is evaluated before the statement is run. If the result is false, the program object continues to run. If the result is true, the program object stops, and the Display Module Source display is shown. At this point, you can evaluate variables, set more breakpoints, and run any of the debug commands.
An alternate method of setting and removing conditional breakpoints is to use the BREAK and CLEAR debug commands.
To set a conditional breakpoint by using the BREAK debug command, type:
BREAK line-number WHEN expression
on the debug command line. Line-number is the line number in the currently displayed view of the module object on which you want to set a breakpoint. expression is the conditional expression that is evaluated when the breakpoint is encountered. The relational operators supported for conditional breakpoints are <, >, =, <=, >=, and <> (not equal).
In non-numeric conditional breakpoint expressions, the shorter expression is implicitly padded with blanks before the comparison is made. This implicit padding occurs before any National Language Sort Sequence (NLSS) translation. See National Language Sort Sequence (NLSS) for more information on NLSS.
To remove a conditional breakpoint by using the CLEAR debug command, type:
CLEAR line-number
on the debug command line. Line-number is number in the currently displayed view of the module object from which you want to remove a breakpoint.
In the statement view, no line numbers are displayed. To set conditional breakpoints in the statement view, type:
BREAK procedure-name/statement-name WHEN expression
on the debug command line. Procedure-name is the name of your CL module. Statement-number(from the compiler listing) is the statement number where you want to stop.
Non-numeric conditional breakpoint expressions are divided into the following two types:
NLSS applies only to non-numeric conditional breakpoint expressions of type Char-8. See Table 10-2 for the possible combinations of non-numeric conditional breakpoint expressions.
The sort sequence table used by the source debugger for expressions of type Char-8 is the sort sequence table specified for the SRTSEQ parameter on the CRTCLMOD or CRTBNDCL commands.
If the resolved sort sequence table is *HEX, no sort sequence table is used. Therefore, the source debugger uses the hexadecimal values of the characters to determine the sort sequence. Otherwise, the specified sort sequence table is used to assign weights to each byte before the comparison is made. Bytes between, and including, shift-out/shift-in characters are not assigned weights.
Table 10-2. Non-numeric Conditional Breakpoint Expressions
Type | Possibilities |
---|---|
Char-8 |
|
Char 16 |
|
|
CL declarations: DCL VAR(&CHAR1) TYPE(*CHAR) LEN(1) DCL VAR(&CHAR2) TYPE(*CHAR) LEN(2) DCL VAR(&DEC1) TYPE(*DEC) LEN(3 1) DCL VAR(&DEC2) TYPE(*DEC) LEN(4 1) Debug command: BREAK 31 WHEN &DEC1 = 48.1 Debug command: BREAK 31 WHEN &DEC2 > &DEC1 Debug command: BREAK 31 WHEN &CHAR2 <> 'A' Comment: 'A' is implicitly padded to the right with one blank character before the comparison is made. Debug command: BREAK 31 WHEN %SUBSTR(&CHAR2 2 1) <= X'F1' Debug command: BREAK 31 WHEN %SUBSTR(&CHAR2 1 1) >= &CHAR1 Debug command: BREAK 31 WHEN %SUBSTR(&CHAR2 1 1) < %SUBSTR(&CHAR2 2 1)
The %SUBSTR built-in function allows you to substring a character string variable. The first argument must be a string identifier, the second argument is the starting position, and the third argument is the number of single byte or double byte characters. Arguments are delimited by one or more spaces.
You can remove all breakpoints, conditional and unconditional, from a program object that has a module object shown on the Display Module Source display by using the CLEAR PGM debug command. To use the debug command, type:
CLEAR PGM
on the debug command line. The breakpoints are removed from all of the modules bound to the program or service program.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.