Displaying Data Structures

You display the contents of a data structure or its subfields as you would any standalone field. You simply use the data structure name after EVAL to see the entire contents, or the subfield name to see a subset.

If the data structure is qualified, specify the subfields using either of the following notations:

EVAL subfield-name OF datastructure-name
EVAL datastructure-name.subfield-name:

For example, to display subfield NAME of qualified data structure INFO, type one of the following:

EVAL NAME OF INFO
EVAL NAME OF INFO EVAL INFO.NAME

When displaying a multiple-occurrence data structure, an EVAL on the data structure name will show the subfields using the current index. To specify a particular occurrence, specify the index in parentheses following the data structure name. For example, to display the contents of the second occurrence of DS1, type:

EVAL DS1(2)

Similarly, to view the contents of a particular occurrence of a subfield, use the index notation.

To determine the value of the current index, enter the following command:

EVAL _QRNU_DSI_name

where name represents the data structure name in question.

If a subfield is defined as an array overlay of another subfield, to see the contents of the overlay subfield, you can use the %INDEX built-in function to specify the occurrence, and the index notation to specify the array.

An alternative way of displaying a subfield which is an array overlay is to use the following notation:

EVAL subfield-name(occurrence-index,array-index)

where the variable subfield-name is the name of the subfield you wish to display, occurrence-index is the number of the array occurrence to display, and array-index is the number of the element to display.

Figure 126 shows some examples of using EVAL with the the data structures defined in DBGEX.

Figure 126. Using EVAL with Data Structures
** Note that you can enter the data structure name or a subfield name. **
> EVAL DS3
  TITLE OF DS3 = 'Mr.  '                  5A   INZ('Mr.  ')
  LASTNAME OF DS3 = 'Jones     '         10A   INZ('Jones    ')
  FIRSTNAME OF DS3 = 'Fred      '        10A   INZ('Fred     ')
> EVAL LastName
  LASTNAME = 'Jones     '
> EVAL DS1                                     OCCURS(3)
  FLD1 OF DS1 = 'ABCDE'                   5A   INZ('ABCDE')
  FLD1A OF DS1(1) = 'A'                   1A   DIM(5) OVERLAY(Fld1)
  FLD1A OF DS1(2) = 'B'                   5B 2 INZ(123.45)
  FLD1A OF DS1(3) = 'C'
  FLD1A OF DS1(4) = 'D'
  FLD1A OF DS1(5) = 'E'
  FLD2 OF DS1 = 123.45
> EVAL _QRNU_DSI_DS1     ** Determine current index value **
  _QRNU_DSI_DS1 = 1
> EVAL DS1=%INDEX(2)     ** Change the occurrence of DS1 **
  DS1=%INDEX(2) = 2
> EVAL Fld1              ** Display a Subfield  **
  FLD1 = 'ABCDE'            (current occurrence)
> EVAL fld1(2)
  FLD1(2) = 'ABCDE'         (second occurrence)
> EVAL Fld1a             ** Display an Array Overlay Subfield **
  FLD1A OF DS1(1) = 'A'     (current occurrence)
  FLD1A OF DS1(2) = 'B'
  FLD1A OF DS1(3) = 'C'
  FLD1A OF DS1(4) = 'D'
  FLD1A OF DS1(5) = 'E'
> EVAL Fld1a(2,1)        ** Display 2nd occurrence, 1st element  **
  FLD1A(2,1) = 'A'
> EVAL Fld1a(2,1..2)     ** Display 2nd occurrence, 1st - 2nd elements **
  FLD1A(2,1) = 'A'
  FLD1A(2,2) = 'B'
> EVAL QUALDS.ID_NUM              ** Display a subfield of a qualified DS
     QUALDS.ID_NUM = 1100022
> EVAL LIKE_QUALDS.ID_NUM         ** Display the same subfield in a different DS
     LIKE_QUALDS.ID_NUM = 0
> EVAL LIKE_QUALDS.COUNTRY(1)     ** An array element from a qualified DS
     LIKE_QUALDS.COUNTRY(1) = 'CANADA'
> EVAL cust(1).parts.item(2).Id_Num       ** Display a subfield of a complex structure
     CUST(1).PARTS.ITEM(2).ID_NUM = 15

To display a data structure for which no subfields have been defined, you must use the character display function of EVAL which is discussed below.



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