IBM Extension
IBM Extension

TYPE Clause

The TYPE clause indicates that the data description of the subject of the entry is specified by a user-defined data type. The user-defined data type is defined using the TYPEDEF clause, which is described in TYPEDEF Clause.

Read syntax diagramSkip visual syntax diagram
>>-TYPE--type-name-1-------------------------------------------><

The following general rules apply:
  • If type-name-1 (defined using the TYPEDEF clause) describes a group item, then the subject of the TYPE clause is a group item whose subordinate elements have the same names, descriptions, and hierarchies as the subordinate elements of type-name-1.
    Note: Since the subject of the TYPE clause may have a level number as high as 49 and type-name-1 may be a group item with 49 levels, the number of levels of this hierarchy may exceed 49. In fact, since descriptions of type-names may reference other type-names, there is no limit to the number of levels in this hierarchy.
  • If a VALUE clause is specified in the data description of the subject of the TYPE clause, any VALUE clause specified in the description of type-name-1 is ignored for this entry.
  • The scoping rules for type names are similar to the scoping rules for data names.
  • Reference modification is not allowed for an elementary item that is the subject of a TYPE clause.
  • The description of type-name-1, including its subordinate data items, cannot contain a LIKE clause that references the subject of the TYPE clause (referencing type-name-1), or any group item to which the subject of the TYPE clause is subordinate.
  • The description of type-name-1, including its subordinate data items, cannot contain a TYPE clause that references the record to which the subject of the TYPE clause (that references type-name-1), is subordinate

    For example, A is a group item defined using the TYPEDEF clause. B is also a group item defined using the TYPEDEF clause, but which also includes a subordinate item of TYPE A. This being the case, the type definition for A cannot include items of TYPE B.

  • The subject of a TYPE clause cannot be renamed in whole, or in part.
  • The subject of a TYPE clause cannot be redefined explicitly or implicitly.
  • If the subject of a TYPE clause is subordinate to a group item, the data description of the group item cannot contain the USAGE clause.
  • The TYPE clause cannot occur in a data description entry with the BLANK WHEN ZERO, FORMAT, JUSTIFIED, LIKE, PICTURE, REDEFINES, RENAMES, SIGN, SYNCHRONIZED, or USAGE clause.
  • The TYPE clause can be specified in a data description entry with the EXTERNAL, GLOBAL, OCCURS, TYPEDEF, and VALUE clauses.

For more information about using the TYPE and TYPEDEF clauses, refer to the IBM® Rational® Development Studio for i: ILE COBOL Programmer's Guide.

End of IBM Extension
End of IBM Extension