Upload
rachmat99
View
225
Download
0
Embed Size (px)
Citation preview
7/29/2019 Command Debug Program
1/28
C/C++ Language
Display a variable
C declaration: int i;
Debug command: EVAL i
Result: i = 29
Comment: The variable can be an expression or
errno. Ranges of array elements can be
displayed by specifying the range:EVAL array[0..4][2..3]
Display a structure
C declaration: typedef struct {
unsigned long l;struct {
char c;
enum {left, right} direction;} s2;
} s1 = { 29, { 'a', left } };
s1* p;
Debug command: EVAL *p
Result: p.l = 29p.s2.c = 'a'
p.s2.direction = left
Debug command: EVAL *p.s2
Result: p.s2.c = 'a'
p.s2.direction = left
Debug command: EVAL *p.s2.c
Result: *p.s2.c = 'a'
Comment: Unqualified structure references display the
entire structure. Complete references display
only the referenced field.
7/29/2019 Command Debug Program
2/28
Display a Class
C++ declaration: class A {public:
int a1;
int a2;};
class B : public A {
public:int b1;
int b2;
} obj;
obj.b1 = 2; obj.b2 = 3;obj.a1 = 1; obj.a2 = 2;
Debug command: EVAL obj
Result: obj.b1 = 2;
obj.b2 = 3;
Debug command: EVAL (A &)obj
Result: (A &)obj.a1 = 1;
(A &)obj.a2 = 2;
Display a Class Variable
C++ declaration: class A {
static int a;int b;
};
int A::a = 5;Debug command: EVAL A::a
Result: ::a = 5
Display a Global Variable
C/C++ declaration:
int a = 5;main()
{
int a;a = 3;
}
Debug command: EVAL ::a
7/29/2019 Command Debug Program
3/28
Result: ::a = 5
Display a string
C declaration: char* s = "My String";char* s1 = "LINE1 \n LINE2";
Debug command: EVAL *s:s
Result: *s:s = "My String"
Comment: The :s format code writescharacters until a null character
is found, for a maximum of
30 characters.
Debug command: EVAL *s1:f
Result: *s1:f =
LINE1
LINE2
Comment: The :f format writes characters until
a null character is found. The newline
character causes a line feed.
Display a character
C declaration: char* s = "My String";
Debug command: EVAL *(s+1)
Result: *(s+1) = 'y'
Debug command: EVAL *s
Result: *s = 'M'
Debug command: EVAL *s:c 15
Result: *s = 'My String '
Comment: The :c format suffix allows the
7/29/2019 Command Debug Program
4/28
display of multiple characters that
begin at the specified character.
Display a pointer
C declaration: char* s = "My String"
Debug command: EVAL s
Result: s = SPP:0001300000AB0000
Debug command: EVAL *s
Result: s = 'M'
Debug command: EVAL *s:s
Result: s = "My String"
Comment: Pointers to a null character display NULL
as a result.
Display a structure in hexadecimal
C declaration: typedef struct {unsigned long l;
struct {
char c;enum {left, right} direction;
} s2;
} s1;s1 p = { 29, { 'a', left } };
Debug command: EVAL p:X
Result:
00000 0000001D 8100.... ........ ........ ....a...........
Debug command: EVAL p:X 30
Result:
00000 0000001D 81000000 00000000 00000000 ....a...........
00010 00000000 00000000 00000000 0000.... ................
7/29/2019 Command Debug Program
5/28
Comment: A multiple line result displays on the
Evaluate Expression display. Entering
the ENTER key with no command switchesfrom the Evaluate Expression display back
to the Display Module Source display.
Entering the ENTER key from the DisplayModule Source display with no command
switches to the Evaluate Expression display.
Display all Local Variables
C/C++ declaration:
main(){
int a = 2;
int b = 3;
}
Debug command: EVAL %LOCALVARS
Result; a = 2
b = 3
Change a scalar variable
C declaration: int i;
Debug command: EVAL i=33
Result: i = 33 = 33
Enter a conditional breakpoint
C declaration: int a,b;
Debug command: BREAK 31 WHEN a
7/29/2019 Command Debug Program
6/28
Result: The program stops if the storage where the
variable i is located is changed to a new
value. The length watched is the size ofvariable i, four bytes.
Debug command: WATCH i : 2
Result: The program stops if the storage startingat where variable i is located is changed
to a new value. The length watched is the
size specified, 2 bytes.
Comment: A maximum of 128 bytes may be watched with
one watch.
The storage location and not the variable iswatched. If the variable is in temporary
storage and the storage is used again, a watchbreakpoint may occur that is unrelated to the
original variable changing.
RPG Language
Display a variable
RPG declaration: D DEC S 3P 1 INZ(73.1)
D EVAL S 3P 1 INT(22.1)D TEAMA DS QUALIFIED
D NAME 15A INZ('TeamA')
Debug command: EVAL DEC
Result: DEC = 73.1
Comment: The variable can be an RPG structure,
table, array, structure field, orstand alone field.
The variable displays using its type asdeclared in the program. This display
formatting can be altered to display the
variable as a hexadecimal value or
7/29/2019 Command Debug Program
7/28
character value.
Hexadecimal values are displayed as anoffset, followed by a hexadecimal format,
followed by a character format. Although
the hexadecimal field always contains amultiple of 16 bytes, only the number of
bytes in the variable are valid.
Debug command: EVAL %VAR(EVAL)
Result: DEC = 22.1
Comment: If the variable has the same name as a debug
command, the %VAR keyword must be used.
Debug command: EVAL TEAMA.NAME
Result: TEAMA.NAME = 'TeamA '
Comment: The field of the structure with the QUALIFIED
attribute is specified as it is in thelanguage, using a period, '.', to separate
the individual parts of the fully qualified
name.
Display an indicator
Debug command: EVAL *INLR
Result: *INLR = '0'
Debug command: EVAL *INLR = '1'
Result: *INLR = '1' = '1'
Debug command: EVAL *IN01
Result: *IN01 = '1'
Debug command: EVAL *IN(01)
Result: *IN(01) = '1'
7/29/2019 Command Debug Program
8/28
Comment: Indicators 01 to 99 can be addressedeither as a field name or with an
array syntax.
Display or change a character
RPG declaration: D CHAR10 S 10 INZ('10CHARLONG')D DIGITS S 10 INZ('0123456789')
D SPCPTR S *
Debug command: EVAL CHAR10
Result: CHAR10 = '10CHARLONG'
Debug command: EVAL %SUBSTR(CHAR10 7 4) = 'TEXT'
Result: %SUBSTR(CHAR10 7 4) = 'TEXT' = 'TEXT'
Debug command:
EVAL %SUBSTR(CHAR10 7 4) = %SUBSTR(DIGITS 1 4)
Result:
%SUBSTR(CHAR10 7 4) = %SUBSTR(DIGITS 1 4) = '0123'
Debug command: EVAL CHAR10 = X'F1F2F3'
Result: CHAR10 = X'F1F2F3' = '123 '
Comment: Character fields can be assigned the value
of a hexadecimal constant.
Debug command: EVAL CHAR10 = '11CHARSLONG'
Result: CHAR10 = '11CHARSLONG' = '11CHARSLON'
Debug command: EVAL CHAR10 = DIGITS
Result: CHAR10 = DIGITS = '0123456789'
Comment: Character fields can be assigned the value
of other character fields.
7/29/2019 Command Debug Program
9/28
Debug command: EVAL SPCPTR : C 10
Result: SPCPTR : C 10 = '10CHARLONG'
Comment: SPCPTR contains the address of CHAR10.
Overall Comment: Assignments repeat the input expressionbefore the equality operator and display
the result following the equality operator.
Assignments of values less than the field
width move the value to the leftmostposition in the space and fill the
remaining field space with blanks.
Truncation occurs if you assign a
value larger than the target.
Display an array
RPG declaration: D ARRAYX S 3 2 DIM(2) INZ(1.23)
D ARRAYD QUALIFIED DIM(3)D LEAF S 3 2 DIM(3) INZ(1.23)
Debug command: EVAL ARRAYX
Result: ARRAYX(1) = 1.23
ARRAYX(2) = 1.23ARRAYX(3) = 1.23
Debug command: EVAL ARRAYX(2) = 3.45
Result: ARRAYX(2) = 3.45 = 3.45
Debug command: EVAL ARRAYX(1..2)
Result: ARRAYX(1) = 1.23ARRAYX(2) = 3.45
Comment: An array reference without subscriptsdisplays up to 500 array elements. The
elements displayed are the first 500
elements of the array.
7/29/2019 Command Debug Program
10/28
A range of array elements can be displayed
by entering the subscript as the first
element of the range, followed by twoperiod characters, followed by the last
element of the range.
Debug command: EVAL ARRAYD
Result: ARRAYD.LEAF(1,1) = 1.23ARRAYD.LEAF(1,2) = 1.23
ARRAYD.LEAF(1,3) = 1.23
ARRAYD.LEAF(2,1) = 1.23
ARRAYD.LEAF(2,2) = 1.23ARRAYD.LEAF(2,3) = 1.23
ARRAYD.LEAF(3,1) = 1.23
ARRAYD.LEAF(3,2) = 1.23
ARRAYD.LEAF(3,3) = 1.23
Debug command: EVAL ARRAYD(2).LEAF(3)
Result: ARRAYD(2).LEAF(3) = 1.23
Debug command: EVAL ARRAYD.LEAF(2,3)
Result: ARRAYD.LEAF(2,3) = 1.23
Display a table
RPG declaration: D TABLEA S 3 0 DIM(15)
Debug command: EVAL TABLEA
Result: TABLEA = 43
Debug command: EVAL TABLEA = 2
Result: TABLEA = 2 = 2
Comment: A table reference without subscripts
uses the current value of the tableindex.
Display a single-occurrence structure
7/29/2019 Command Debug Program
11/28
RPG declaration: D STRUCT DS
D FIELD1 2A INZ('AB')
D FIELD2 1A INZ('c')D FIELD3 3S 1 INZ(78.9)
D QSTRUCT DS QUALIFIED
D QFIELD1 2A INZ('AB')D QFIELD2 1A INZ('c')
D QFIELD3 3S 1 INZ(78.9)
Debug command: EVAL STRUCT:C
Result: STRUCT:C = 'ABc '
Debug command: EVAL STRUCT
Result: FIELD1 OF STRUCT = 'AB'
FIELD2 OF STRUCT = 'c'FIELD3 OF STRUCT = 78.9
Debug command: EVAL QSTRUCT
Result: QSTRUCT.QFIELD1 = 'AB'
QSTRUCT.QFIELD2 = 'c'QSTRUCT.QFIELD3 = 78.9
Debug command: EVAL STRUCT:X 5
Result:0 C1C283F7 F8...... ........ ........ ABc78...........
Comment: A multiple line result displays on the
Evaluate Expression display. Enteringthe ENTER key with no command switches
from the Evaluate Expression display
back to the Display Module Sourcedisplay. Entering the ENTER key
from the Display Module Source
display with no command switchesto the Evaluate Expression display.
When debugging OPM languages, structures
are displayed as if :C was appended
7/29/2019 Command Debug Program
12/28
to the EVAL command.
Display a multiple-occurrence structure
RPG declaration: D STRUCT DS OCCURS(3)
D FIELD1 2A INZ('AB')D FIELD2 1A INZ('c')
D FIELD3 3P 1 INZ(78.9)
Debug command: EVAL STRUCT
Result: FIELD1 OF STRUCT = 'AB'
FIELD2 OF STRUCT = 'c'FIELD3 OF STRUCT = 78.9
Comment: A reference without subscripts to a
multiple-occurrence structure displaysthe structure using the current value
of the index set with the OCCURSoperation code.
Setting the index with OCCURS is not
supported for OPM RPG.
Display a qualified structure
RPG declaration: D QSTRUCT2 DS QUALIFIEDD QFIELD21 2A INZ('AB')
D QFIELD22 1A INZ('c')
D QCOMP LIKEDS(TEMPLATE)D TEMPLATE DS QUALIFIED BASED(@)
D QFIELD23 2A
Debug command: EVAL QSTRUCT2
Result: QSTRUCT2.QFIELD21 = 'AB'QSTRUCT2.QFIELD22 = 'c'
QSTRUCT2.QCOMP.QFIELD23 = ' '
Debug command: EVAL QSTRUCT2.QCOMP.QFIELD23
Result: QSTRUCT2.QCOMP.QFIELD23 = ' '
Display a based variable
RPG declaration: D STRUCT DS BASED(SPCPTR)
7/29/2019 Command Debug Program
13/28
D FIELD1 2A INZ('AB')
D FIELD2 1A INZ('c')
D FIELD3 3P 1 INZ(78.9)D SPCPTR S *
Debug command: EVAL FIELD3
Result: FIELD3 = 78.9
Debug command: EVAL FIELD3 = 12.3
Result: FIELD3 = 12.3 = 12.3
Comment: The pointer must be set by the program being
debugged before a command accessing the based
variable is entered.
Display a pointer variable
RPG declaration: D SPCPTR S *
D NULLPTR S * INZ(*NULL)
Debug command: EVAL SPCPTR
Result: SPCPTR = SPP:000130000AB00000
Debug command: EVAL NULLPTR
Result: NULLPTR = SPP:NULL
Debug command: EVAL SPCPTR:C 4
Result: SPCPTR:C 4 = 'ONE '
Debug command: EVAL SPCPTR:X 4
Result:
00000 D6D5C540 ........ ........ ........ - ONE ..........
Comments: In the above example SPCPTR contains the
address of a fixed length string which is
four bytes long and contains the value:
'ONE '.
7/29/2019 Command Debug Program
14/28
Enter a conditional breakpoint
RPG declaration: D STRUCT DS OCCURS(3)
D FIELD1 2A INZ('AB')
D FIELD2 1A INZ('c')D FIELD3 3P 1 INZ(78.9)
Debug command: BREAK 31 WHEN FIELD3 = 78.9
Result: The program stops before line 31 if the
expression FIELD1 = 78.9 is true.
Comment: Relational operators supported are , and (not equal).
Watch a variable
RPG declaration: D FLD S 3A INZ('abc')
Debug command: WATCH FLD
Result: The program stops if the storage where the
variable FLD is located is changed to a new
value. The length watched is the size of
variable FLD, three bytes.
Debug command: WATCH FLD : 8
Result: The program stops if the storage starting
at where variable FLD is located is changedto a new value. The length watched is the
size specified, eight bytes.
Comment: A maximum of 128 bytes may be watched with
one watch.
The storage location and not the variable is
watched. If the variable is in temporarystorage and the storage is used again, a
watch breakpoint may occur that is unrelated
to the original variable changing.
7/29/2019 Command Debug Program
15/28
CL Language
Display or change a packed decimal
CL declarations:
DCL VAR(&DEC1) TYPE(*DEC) LEN(3 1) VALUE(73.1)DCL VAR(&DEC2) TYPE(*DEC) LEN(2 1) VALUE(3.1)
Debug command: EVAL &DEC1
Result: &DEC1 = 73.1
Debug command: EVAL &DEC1 = 12.3
Result: &DEC1 = 12.3 = 12.3
Debug command: EVAL &DEC1 = &DEC2
Result: &DEC1 = &DEC2 = 3.1
Display or change a logical variable
CL declarations: DCL VAR(&LGL1) TYPE(*LGL) VALUE('1')
DCL VAR(&LGL2) TYPE(*LGL)
Debug command: EVAL &LGL1
Result: &LGL1 = '1'
Debug command: EVAL &LGL1 = X'F0'
Result: &LGL1 = X'F0' = '0'
Debug command: EVAL &LGL2 = &LGL1
Result: &LGL2 = &LGL1 = '0'
Display or change a character
CL declarations:
7/29/2019 Command Debug Program
16/28
DCL VAR(&CHAR1) TYPE(*CHAR) LEN(1) VALUE('A')
DCL VAR(&CHAR2) TYPE(*CHAR) LEN(10)
Debug command: EVAL &CHAR1
Result: &CHAR1 = 'A'
Debug command: EVAL &CHAR1 = X'F0F1F2F3'
Result: &CHAR1 = X'F0F1F2F3' = '0'
Comment: Truncation results if the target character
operand is shorter than the source
character operand.
Debug command: EVAL &CHAR2 = 'ABC'
Result: &CHAR2 = 'ABC' = 'ABC '
Comment: Padding (with blanks) results if the targe
character operand is longer than the sourc
character operand.
Debug command: EVAL %SUBSTR(&CHAR2 2 2)
Result: %SUBSTR(&CHAR2 2 2) = 'BC'
Comment: Character strings can be changed with the
substring expression. The first argument
to %SUBSTR must be a string identifier, thesecond argument is the starting position,
and the third argument is the number
of characters. Arguments are delimitedby one or more spaces.
Debug command:
EVAL %SUBSTR(&CHAR2 1 2) = %SUBSTR(&CHAR2 3 1)
Result:
7/29/2019 Command Debug Program
17/28
%SUBSTR(&CHAR2 1 2) = %SUBSTR(&CHAR2 3 1)= 'C '
Comment: A substring expression can be assignedanother substring expression. The
expression can refer to the same string
identifier. Padding (with blanks) results
since the target substring is longer than
the source substring.
Debug command: EVAL &CHAR2
Result: &CHAR2 = 'C C '
Comment: This example demonstrates the effect of the
above operations on &CHAR2.
Enter a conditional breakpoint
CL declarations: DCL VAR(&CHAR1) TYPE(*CHAR) LEN(1)
DCL VAR(&CHAR2) TYPE(*CHAR) LEN(2)DCL VAR(&DEC1) TYPE(*DEC) LEN(3 1)
Debug command: BREAK 31 WHEN &DEC1 = 48.1
Result: The program stops before line 31 if the
expression &DEC1 = 48.1 is true.
Comment: Relational operators supported are , and (not equal).
Debug command: BREAK 31 WHEN &CHAR1 'A'
Result: The program stops before line 31 if
the expression &CHAR1 'A' is true.
Debug command: BREAK 31 WHEN %SUBSTR(&CHAR2 2 1)
7/29/2019 Command Debug Program
18/28
Comment: Character strings can be changed with the
substring in conditional breakpoints. The
first argument to %SUBSTR must be a stringidentifier, the second argument is the
starting position, and the third argument
is the number of characters.
Debug command: BREAK 31 WHEN %SUBSTR(&CHAR2 1 1) >= &CHAR1
Result: The program stops before line 31 if the
expression %SUBSTR(&CHAR2 1 1)
>= &CHAR1 is true.
Watch a variable
CL declaration: DCL VAR(&CHAR3) TYPE(*CHAR) LEN(3)
Debug command: WATCH &CHAR3
Result: The program stops if the storage where the
variable &CHAR3 is located is changed to a newvalue. The length watched is the size of
variable &CHAR3, three bytes.
Debug command: WATCH &CHAR3 : 8
Result: The program stops if the storage startingat where variable &CHAR3 is located is changed
to a new value. The length watched is the
size specified, eight bytes.
Comment: A maximum of 128 bytes may be watched with
one watch.
The storage location and not the variable is
watched. If the variable is in temporarystorage and the storage is used again, a watch
breakpoint may occur that is unrelated to the
original variable changing.
COBOL Language
Display a variable
7/29/2019 Command Debug Program
19/28
COBOL declaration: 77 DEC PIC 99V9 VALUE 73.1.
77 EVAL PIC 99V9 VALUE 22.1
Debug command: EVAL DEC
Result: DEC = 73.1
Debug command: EVAL DEC:X
Result:
00000 F7F3F1.. ........ ........ ........ 731.............
Debug command: EVAL DEC:C
Result: DEC = ' '
Comment: The variable is displayed using its type
as declared in the program. This displayformatting can be altered to display the
variable as a hexadecimal value or a
character value.
Hexadecimal values are displayed as an
offset, followed by a hexadecimal format,
followed by a character format. Althoughthe hexadecimal field always contains a
multiple of 16 bytes, only the number of
bytes in the variable are valid.
Debug Command: EVAL %VAR(EVAL)
Result: DEC = 22.1
Comment: If the variable has the same name as a debug
command, the %VAR keyword must be used.
Display or change a character
COBOL declaration: 01 NAME PIC X(7) VALUE "Example" .
01 LAST PIC X(5) VALUE "Smith".
01 FIRST PIC X(1) VALUE "J".
7/29/2019 Command Debug Program
20/28
Debug command: EVAL NAME
Result: NAME = 'Example'
Debug command: EVAL NAME = LAST
Result: NAME = LAST = 'Smith '
Debug command: EVAL NAME = 'Smyth'
Result: NAME = 'Smyth' = 'Smyth '
Debug command: EVAL %SUBSTR(NAME 7 1) = FIRST
Result: %SUBSTR(NAME 7 1) = FIRST = 'J'
Overall comment: Assignments repeat the input expression
before the equality operator and displaythe result following the equality operator.
Assignments of values less than the field
width move the value to the leftmost
position in the space and fill theremaining field space with blanks.
Display an array
COBOL declaration: 01 A PIC X(5) OCCURS 5 TIMES.
Debug command: EVAL A(4)
Result: A(4) = 'FOUR '
Debug command: EVAL A
Result: A(1) = 'ONE '
A(2) = 'TWO '
A(3) = 'THREE'A(4) = 'FOUR '
A(5) = 'FIVE '
Debug command: EVAL A(2..4)
7/29/2019 Command Debug Program
21/28
Result: A(2) = 'TWO '
A(3) = 'THREE'
A(4) = 'FOUR '
Comment: An array reference without subscripts
displays up to 500 array elements. Theelements displayed are the first 500
elements of the array.
A range of array elements can be displayed
by entering the subscript as the first
element of the range, followed by two
period characters, followed by the lastelement of the range.
Displaying and changing an index
COBOL declaration:01 MY-YEAR.
05 MY-MONTH PIC 99 OCCURS 12 INDEXED BY CURRENT-MONTH.
01 NEXT-MONTH USAGE IS INDEX.01 LAST-MONTH PIC 9(5).
Debug command: EVAL CURRENT-MONTH = 7
Result: CURRENT-MONTH = 7 = 7
Comment: The index contains the index value
multiplied by the array element length,
but only the index is shown. Whendebugging an OPM COBOL program this is
not the case. The value assigned to an
index variable must be the offset inbytes to the array element.
Debug command: EVAL NEXT-MONTH = CURRENT-MONTH
Result: NEXT-MONTH = CURRENT-MONTH = 12
Comment: Assignments from indexes to index data
items do not divide by the array
element length.
7/29/2019 Command Debug Program
22/28
Debug command: EVAL NEXT-MONTH = 0
Result: NEXT-MONTH = 0 = 0
Comment: Assignments from numeric values to index
data items are allowed in the debugger,
but you must multiply the index by thearray element length. The example sets
the index to the first array element.
Debug command: EVAL LAST-MONTH = CURRENT-MONTH
Result: LAST-MONTH = CURRENT-MONTH = 7
Comment: Assignments from indexes to numeric
variables divide the index value bythe array element length. For OPM
COBOL the value assigned will be
the offset to the element in the arraythat the index refers to.
Display a structure
COBOL declaration: 01 ACCOUNT.
02 NUMBER PIC 99999.
02 NAME.LAST PIC X(20).
FIRST PIC X(10).
Debug command: EVAL ACCOUNT
Result:
NUMBER OF ACCOUNT = 12345LAST OF NAME OF ACCOUNT = 'SMITH '
FIRST OF NAME OF ACCOUNT = 'JOHN '
Debug command: EVAL FIRST OF ACCOUNT
Result: FIRST OF ACCOUNT = 'JOHN '
Comment: For OPM COBOL the structure ACCOUNT
will be displayed as a string.
7/29/2019 Command Debug Program
23/28
Display complex arrays
COBOL declaration:
01 MY-YEAR.05 THIS-MONTH OCCURS 12.
10 THIS-MONTHS-NAME X(4).
10 THIS-WEEK PIC 99 OCCURS 5.05 THIS-WEEK OCCURS 52.
Debug command: EVAL THIS-WEEK
Result: The result is an error. This is an
ambiguous reference. The debugger
cannot discern which THIS-WEEK you want.
Debug command: EVAL THIS-WEEK OF THIS-MONTH(1)
Result: THIS-WEEK OF THIS-MONTH OF MY-YEAR(1,1) = 1
THIS-WEEK OF THIS-MONTH OF MY-YEAR(1,2) = 2THIS-WEEK OF THIS-MONTH OF MY-YEAR(1,3) = 3
THIS-WEEK OF THIS-MONTH OF MY-YEAR(1,4) = 4
THIS-WEEK OF THIS-MONTH OF MY-YEAR(1,5) = 0
Comment: The entire THIS-WEEK array for MONTH(1) is
displayed. When debugging OPM COBOL, the
names displayed will be the exact text thatwas entered as part of the EVAL command.
Debug command: EVAL THIS-WEEK OF THIS-MONTH(1,2)
Result: THIS-WEEK OF THIS-MONTH(1,2) = 2
Debug command: EVAL THIS-WEEK OF MY-YEAR(52)
Result: This returns an error for an ambiguousreference. The debugger discovers the
error for THIS-WEEK before examining
the subscript.
Debug command: EVAL THIS-MONTH OF MY-YEAR(1)
7/29/2019 Command Debug Program
24/28
Result:
THIS-MONTHS-NAME OF THIS-MONTH OF MY-YEAR(1) = 'JAN '
THIS-WEEK OF THIS-MONTH OF MY-YEAR(1,1) = 1THIS-WEEK OF THIS-MONTH OF MY-YEAR(1,2) = 2
THIS-WEEK OF THIS-MONTH OF MY-YEAR(1,3) = 3
THIS-WEEK OF THIS-MONTH OF MY-YEAR(1,4) = 4THIS-WEEK OF THIS-MONTH OF MY-YEAR(1,5) = 5
Comment: The entire THIS-MONTH structure for
the first THIS-MONTH array element
is displayed.
Debug command: EVAL THIS-MONTH
Result: This lists all twelve THIS-MONTH arrayelements. The preceding example showed
what a single element looks like. Thisis repeated twelve times.
Enter a conditional breakpoint
COBOL declaration: 01 DEC PIC 99V9 VALUE 73.1.
Debug command: BREAK 345 WHEN DEC = 73.1
Result: The program stops before line 345 if the
expression DEC = 73.1 is true.
Comment: Relational operators supported are , and (not equal).
Watch a variable
COBOL declaration: 01 DEC PIC 999V999.
Debug command: WATCH DEC
Result: The program stops if the storage where the
variable DEC is located is changed to a newvalue. The length watched is the size of
variable DEC, six bytes.
7/29/2019 Command Debug Program
25/28
Debug command: WATCH DEC : 4
Result: The program stops if the storage startingat where variable DEC is located is changed
to a new value. The length watched is the
size specified, four bytes.
Comment: A maximum of 128 bytes may be watched withone watch.
The storage location and not the variable is
watched. If the variable is in temporarystorage and the storage is used again, a
watch breakpoint may occur that is unrelated
to the original variable changing.
Java Language
Display a Variable
Java declaration: int i;
Debug command: EVAL i
Result: i = 29
Comment: The variable can be an expression.
Ranges of array elements can bedisplayed by specifying the range:
EVAL array[0..4][2..3]
Display a Class
Java declaration: public class ABC
{public int a,b,c;
.
.
.
}
public class XYZ extends ABC{
public int x,y,z;
.
.
7/29/2019 Command Debug Program
26/28
.
}
XYZ z = new XYZ();
Debug command: EVAL z
Result: z.x = 1
z.y = 2z.z = 1
Comment: When a variable which is an instance
of a class is displayed only thevariables associated with the
immediate derived class are
displayed. To display all the
fields associated with a base orsuperclass the object should be
cast to the class that containsthe fields to display.
Debug command: EVAL (ABC)z
Result: ((ABC)z).a = 5
((ABC)z).b = 6
((ABC)z).c = 7
Display a Character
Java declaration: char ch;
Debug command: EVAL ch
Result: ch = 'A'
Display a String
Java declaration: String str = "A String"
Debug command: EVAL str
Result: str = A string
7/29/2019 Command Debug Program
27/28
Display a Thread Name
Debug command: EVAL __JavaThreadName
Result: __JavaThreadName = serverthread
Comment: This command will display the name of
the current thread.
Debug command: EVAL __THREADID
Result: __THREADID = 15
Comment: This command will display a decimal
number that is the thread identifier.
Within the system debugger andthe rest of the system this value
is displayed in hexadecimal format
To view this value in hexadecimal
format use the : X operator.
Change a Scalar Variable
Java declaration: int i;
Debug command: EVAL i = 1
Result: i = 1 = 1
Comment: The result should be interpreted asthe value of expression i = 1 is
the value 1.
Enter a Conditional Breakpoint
Java declaration: int i, j;
Debug command: BREAK 2 WHEN i 5
Comment: The instanceof operator andArray.length syntax (where Array
is an instance of an array) can
also be used within conditions
for setting breakpoints.
7/29/2019 Command Debug Program
28/28