Previous Topic Next topic Print topic


Type Specifier

A type specifier is a declaration of a type, such as a class, interface, enum and so on.

type-specifier

simple-type-specifier

simple-type-specifier

predefined-type-specifier

predefined-type-specifier

Example

Predefined Types
  01 dAmount  decimal.
  01 asNames string occurs 5.
  01 abFigures binary-long occurs any.
TYPE keyword
  01 objMyType type MyType.  
  01 objDataTime type DateTime.        *> .NET COBOL
  01 objDataTime type java.util.Date.  *> JVM COBOL

Where:

  • objMyType is defined as an object of type MyType
  • objDataTime is defined as an object type DateTime in .NET COBOL or java.util.Date in JVM COBOL.

Long Type Names

To define a namespace to represent long class names so that you need to type a short name only, use the ILUSING directive.

Type Compatibility with Managed Types

All the predefined COBOL data types and any further managed types that you define are mapped onto the corresponding native managed type (.NET or JVM), but they must conform to the following rules. They:

  • Must be declared at 01 (or 77) level
  • Must have no REDEFINES or RENAMES
  • Must never be the subject of reference modification
  • Must never be the subject of the ADDRESS OF clause
  • May use format 3 of the OCCURS clause to declare an array

Any COBOL data item that does not follow these rules, or is of any other category, is not considered to be a managed type (.NET or JVM) and is allocated by the Compiler within an internally managed byte array. COBOL pointer data items always point into one of these byte arrays.

Previous Topic Next topic Print topic