ILE COBOL Programmer's Guide

Displaying Records, Group Items, and Arrays

You can use the EVAL debug command to display structures, records, and arrays. Unless the record, group item, or array is on the current line, you must first qualify the record, group item, or array that you want to display by identifying its line number using the QUAL debug command. Refer to Displaying Variables and Expressions for a description of how to use the QUAL debug command. To display a record, group item, or array, type:

EVAL data-name

on the debug command line. data-name is the name of the record, group item, or array that you want to display. The value of the record, group item, or array will be shown on the Evaluate Expression display.

The following example shows you how to display the contents of an ILE COBOL group item.

     01  ACCOUNT.
         02  NUMBER              PIC 9(5).
         02  FULL-NAME.
             03  LAST-NAME       PIC X(20).
             03  FIRST-NAME      PIC X(10).

To display the contents of the group item ACCOUNT, type:

EVAL ACCOUNT

on the debug command line. The current contents of the group item ACCOUNT will be shown on the Evaluate Expression display as in Figure 48.

To display the contents of a single element of the group item ACCOUNT, such as element FIRST-NAME OF FULL-NAME OF ACCOUNT, type:

EVAL FIRST-NAME OF FULL-NAME OF ACCOUNT

on the debug command line. The current contents of the element FIRST-NAME OF FULL-NAME OF ACCOUNT will be shown on the Evaluate Expression display as in Figure 48. Press Enter to return to the Display Module Source display. You can also display elements using partially qualified names provided that the name is qualified sufficiently to resolve any name ambiguities.

Figure 48. Displaying a Group Item using the EVAL Debug Command

+--------------------------------------------------------------------------------+
|                               Evaluate Expression                              |
| Previous Debug expressions                                                     |
| > EVAL ACCOUNT                                                                 |
|   NUMBER OF ACCOUNT = 12345                                                    |
|   LAST-NAME OF FULL-NAME OF ACCOUNT = 'SMITH               '                   |
|   FIRST-NAME OF FULL-NAME OF ACCOUNT = 'JOHN      '                            |
| > EVAL FIRST-NAME OF FULL-NAME OF ACCOUNT                                      |
|   FIRST-NAME OF FULL-NAME OF ACCOUNT = 'JOHN      '                            |
+--------------------------------------------------------------------------------+

The following example shows you how to display the contents of an ILE COBOL array.

     05  A       PIC X(5) OCCURS 5 TIMES.

To display the contents of the array A, type:

EVAL A

on the debug command line. The current contents of the array A will be shown on the Evaluate Expression display as in Figure 49.

To display the contents of a range of elements of the array A, type:

EVAL A(2..4)

on the debug command line. The current contents of elements A(2), A(3), and A(4) of the array A will be shown on the Evaluate Expression display as in Figure 49.

To display the contents of a single element of the array A, such as element A(4), type:

EVAL A(4)

on the debug command line. The current contents of the element A(4) will be shown on the Evaluate Expression display as in Figure 49. Press F3 (Exit) to return to the Display Module Source display.

Note:
The subscript value specified on the EVAL debug command can only be a numeric value. For example, A(4) is accepted but A(I+2) or A(2*3) are not accepted.

Figure 49. Displaying an Array using the EVAL Debug Command

+--------------------------------------------------------------------------------+
|                                    Evaluate Expression                         |
| Previous Debug expressions                                                     |
| > EVAL A                                                                       |
|   A(1) = 'ONE  '                                                               |
|   A(2) = 'TWO  '                                                               |
|   A(3) = 'THREE'                                                               |
|   A(4) = 'FOUR '                                                               |
|   A(5) = 'FIVE '                                                               |
| > EVAL A(2..4)                                                                 |
|   A(2) = 'TWO  '                                                               |
|   A(3) = 'THREE'                                                               |
|   A(4) = 'FOUR '                                                               |
| > EVAL A(4)                                                                    |
|   A(4) = 'FOUR '                                                               |
+--------------------------------------------------------------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]