Evaluating Based Variables
When a variable is based on a pointer, the variable might not be available for evaluation by the debugger using a normal EVAL command. This can happen when the basing pointer is itself based, or when the basing pointer is an entry parameter passed by reference (including read-only reference using the CONST keyword).
For example, in the following program, "basedFld" is based on pointer "parmPtr" which is an input parameter.
/copy myPgmProto
D myPgm pi
D parmPtr *
D basedFld s 5a based(parmPtr)
- Evaluate the basing pointer using the :c or :x notation described
in Displaying Data Addressed by Pointers. For example
Note: this method does not work well with data that has a hexadecimal representation that does not resemble the natural representation, such as packed, integer or UCS-2 data.===> eval parmPtr:c ===> eval parmPtr:x - Use the debugger's "arrow" notation to explicitly specify the basing
pointer. This method can also be used to change the variable.
===> eval parmPtr->basedFld ===> eval parmPtr->basedFld = 'abcde'
D storage s 5a inz('abcde')
D val s 5a
D basedVal s 5a based(p1)
D p1 s * based(p2)
D p2 s * based(p3)
D p3 s *
D ptr1 s * inz(%addr(storage))
D ptr2 s * inz(%addr(ptr1))
D ptr3 s * inz(%addr(ptr2))
C eval p3 = ptr3
C eval p2 = ptr2
C eval p1 = ptr1
C eval val = basedVal
For example, to evaluate basedVal:
===> EVAL p3->p2->p1->basedVal
aaaaaaaa
bbbb
cccc
dddd
a. variable name
b. basing pointer of variable ->
c. basing pointer of basing pointer ->
d. and so on