Base type entries

A base type is represented by a debugging information entry with the tag DW_TAG_base_type.

A base type entry has a DW_AT_encoding attribute describing how the base type is encoded and is to be interpreted. The value of this attribute is an integer constant. IBM® extensions are introduced to describe the following data types:
DW_AT_encoding name Value Description
DW_ATE_IBM_complex_float_hex 0xde IBM hex complex floating point
DW_ATE_IBM_float_hex 0xdf IBM hex floating point
DW_ATE_IBM_imaginary_float_hex 0xe0 IBM hex imaginary floating point
DW_ATE_IBM_edited_national 0xe5 COBOL national numeric edited data type
DW_ATE_IBM_edited_DBCS 0xe6 COBOL DBCS edited data type
DW_ATE_IBM_external_float 0xe7 COBOL external floating point data type
DW_ATE_IBM_external_float_national 0xe8 COBOL national external floating point data type
DW_ATE_IBM_string_national 0xe9 COBOL national alphanumeric data type
DW_ATE_IBM_string_DBCS 0xea COBOL DBCS alphanumeric data type
DW_ATE_IBM_numeric_string_national 0xeb COBOL national numeric data type
DW_ATE_IBM_index_name 0xec COBOL index name
DW_ATE_IBM_index_data_item 0xed COBOL index data item
DWARF standard encoding is used for the following data types:

In COBOL, a base type entry may have a DW_AT_picture_string attribute whose value is a null-terminated string containing the picture string as specified in the source code.

A base type entry has either a DW_AT_byte_size attribute or a DW_AT_bit_size attribute whose integer constant value is the amount of storage needed to hold a value of the type.

A packed decimal type (for example, DW_ATE_packed_decimal) may have a DW_AT_decimal_sign attribute, whose value is an integer constant that conveys the representation of the sign of the decimal type. The only allowable value is DW_DS_unsigned. Absence of the attribute indicates that there is a sign in the encoding.

A zoned decimal type (for example, DW_ATE_numeric_string and DW_ATE_IBM_numeric_string_national) may have a DW_AT_decimal_sign attribute, whose value is an integer constant that conveys the representation of the sign of the decimal type. Its integer constant value is interpreted to mean that the type has a leading overpunch, trailing overpunch, leading separate or trailing separate sign representation or, alternatively, no sign at all.

A decimal sign attribute has the following values:

In COBOL, a native binary number type (for example, DW_ATE_signed_fixed and DW_ATE_unsigned_fixed) has a DW_AT_IBM_native_binary attribute, which is a flag. This attribute indicates that the data item is represented in storage as native binary data.

A fixed-point scaled integer base type (for example, DW_ATE_numeric_string, DW_ATE_signed_fixed, DW_ATE_unsigned_fixed, DW_ATE_packed_decimal, and DW_ATE_numeric_string_national) or a COBOL numeric edited type (for example, DW_ATE_edited and DW_ATE_IBM_edited_national) has the following attributes:
  • A DW_AT_digit_count attribute, whose value is an integer constant that represents the number of digits in an instance of the type.
  • A DW_AT_decimal_scale attribute, whose value is an integer constant that represents the exponent of the base ten scale factor to be applied to an instance of the type. A scale of zero puts the decimal point immediately to the right of the least significant digit. Positive scale moves the decimal point to the right and implies that additional zero digits on the right are not stored in an instance of the type. Negative scale moves the decimal point to the left; if the absolute value of the scale is larger than the digit count, this implies additional zero digits on the left are not stored in an instance of the type.

An alphanumeric base type (for example, DW_ATE_IBM_string_national and DW_ATE_IBM_string_DBCS) may have a DW_AT_IBM_justify attribute, which is a flag. This attribute indicates whether the object is justified to the right.

Start of changeAn UTF-8 string type (DW_ATE_UTF) might have a DW_AT_IBM_string_length attribute, whose value is an integer constant that represents the number of characters of the string.End of change

A COBOL index name (for example, DW_ATE_IBM_index_name), has a DW_AT_byte_stride attribute, whose value is the size of each table entry.

See the following DWARF sample:
* pic ABBA(5).
DW_TAG_base_type
  DW_AT_encoding (DW_ATE_edited)
  DW_AT_picture_string (ABBA(5))
  DW_AT_byte_size (8)

* pic S999V999 SIGN TRAILING.
DW_TAG_base_type
  DW_AT_encoding (DW_ATE_numeric_string)
  DW_AT_picture_string (S999V999)
  DW_AT_byte_size (6)
  DW_AT_decimal_sign (DW_DS_trailing_overpunch)
  DW_AT_digit_count (6)
  DW_AT_decimal_scale (-3)

* pic S999V99 USAGE BINARY.
DW_TAG_base_type
  DW_AT_encoding (DW_ATE_signed_fixed)
  DW_AT_picture_string (S999V99)
  DW_AT_byte_size (4)
  DW_AT_digit_count (5)
  DW_AT_decimal_scale (-2)

* pic S9(3)V99 PACKED-DECIMAL.
DW_TAG_base_type
  DW_AT_encoding (DW_ATE_packed_decimal)
  DW_AT_picture_string (S9(3)V99)
  DW_AT_byte_size (3)
  DW_AT_digit_count (5)
  DW_AT_decimal_scale (-2)

* pic 999PP COMP-3.
DW_TAG_base_type
  DW_AT_encoding (DW_ATE_packed_decimal)
  DW_AT_decimal_sign (DW_DS_unsigned)
  DW_AT_picture_string (999PP)
  DW_AT_byte_size (2)
  DW_AT_digit_count (3)
  DW_AT_decimal_scale (2)

* pic +Z,ZZ9.99.
DW_TAG_base_type
  DW_AT_encoding (DW_ATE_edited)
  DW_AT_picture_string (+Z,ZZ9.99)
  DW_AT_byte_size (9)
  DW_AT_digit_count (6)
  DW_AT_decimal_scale (-2)

* pic 9999/99 USAGE NATIONAL.
DW_TAG_base_type
  DW_AT_encoding (DW_ATE_IBM_edited_national)
  DW_AT_picture_string (9999/99)
  DW_AT_byte_size (14)
  DW_AT_digit_count (6)
  DW_AT_decimal_scale (0)

* pic N(4) USAGE NATIONAL.
DW_TAG_base_type
  DW_AT_encoding (DW_ATE_IBM_string_national)
  DW_AT_picture_string (N(4))
  DW_AT_byte_size (8)

* pic NNBBNN USAGE NATIONAL.
DW_TAG_base_type
  DW_AT_encoding (DW_ATE_IBM_edited_national)
  DW_AT_picture_string (NNBBNN)
  DW_AT_byte_size (12)

Start of change* pic UUUU.
DW_TAG_base_type
  DW_AT_encoding (DW_ATE_UTF)
  DW_AT_picture_string (UUUU)
  DW_AT_byte_size (16)
  DW_AT_IBM_string_length (4)
End of change
* 01  year-accum.
*   02  month-entry occurs 12 indexed by IDXNAME.
*     03  STABS  USAGE IDXITEM.
DW_TAG_base_type     * IDXNAME
  DW_AT_encoding (DW_ATE_IBM_index_name)
  DW_AT_byte_size (4)
  DW_AT_byte_stride (4)
DW_TAG_base_type     * IDXITEM
  DW_AT_encoding (DW_ATE_IBM_index_data_item)
  DW_AT_byte_size (4)