Modifying the value of a COBOL variable
Example: sample COBOL program for debugging
To list the contents of a single variable, move the cursor to an
occurrence of the variable name in the Source window and press PF4 (
LIST
).
Remember that z/OS® Debugger starts after program
initialization but before symbolic COBOL variables are initialized,
so you cannot view or modify the contents of variables until you have
performed a step or run. The value is displayed in the Log window.
This is equivalent to entering LIST TITLED variable
on
the command line. Run the COBCALC program to the statement
labeled CALC1 , and enter AT 46
; GO ;
on the z/OS Debugger command
line. Move the cursor over INPUT-1
and press LIST
(PF4).
The following appears in the Log window: LIST ( INPUT-1 ) ;
INPUT-1 = 'LOAN '
To modify the value of
INPUT-1
, enter on the command
line: MOVE 'pvalue' to INPUT-1 ;
You can
enter most COBOL expressions on the command line.Now step into the call to COBVALU by pressing PF2 (
STEP
)
and step until the statement labeled VALU2 is
reached. To view the attributes of the variable INTEREST
,
issue the z/OS Debugger command:
DESCRIBE ATTRIBUTES INTEREST ;
The result
in the Log window is: ATTRIBUTES FOR INTEREST
ITS LENGTH IS 4
ITS ADDRESS IS 00011DC8
02 COBVALU:>INTEREST S999V99 COMP
You can use
this action as a simple browser for group items and data hierarchies.
For example, you can list all the values of the elementary items
for the CHAR-DATA group with the command: LIST CHAR-DATA ;
with results in the Log window appearing something like this: LIST CHAR-DATA ;
02 COBVALU:>INPUT-1 of 01 COBVALU:>CHAR-DATA = '.12 5 '
Invalid data for 02 COBVALU:>PAYMENT-OUT of 01 COBVALU:>CHAR-DATA is found.
02 COBVALU:>INTEREST-IN of 01 COBVALU:>CHAR-DATA = '.12 '
02 COBVALU:>NO-OF-PERIODS-IN of 01 COBVALU:>CHAR-DATA = '5 '
02 COBVALU:>INPUT-BUFFER of 01 COBVALU:>CHAR-DATA = '5069837544'
SUB(1) of 02 COBVALU:>BUFFER-ARRAY of 01 COBVALU:>CHAR-DATA = '50'
SUB(2) of 02 COBVALU:>BUFFER-ARRAY of 01 COBVALU:>CHAR-DATA = '69'
SUB(3) of 02 COBVALU:>BUFFER-ARRAY of 01 COBVALU:>CHAR-DATA = '83'
SUB(4) of 02 COBVALU:>BUFFER-ARRAY of 01 COBVALU:>CHAR-DATA = '75'
SUB(5) of 02 COBVALU:>BUFFER-ARRAY of 01 COBVALU:>CHAR-DATA = '44'
Note: If you use the
LIST
command to list the contents
of an uninitialized variable, or a variable that contains invalid
data, z/OS Debugger displays INVALID
DATA
.Refer to the following topics for more information related to the material discussed in this topic.
- Related tasks
- Using COBOL variables with z/OS Debugger