CLASS-ID paragraph for defining a class

Use the CLASS-ID paragraph in the IDENTIFICATION DIVISION to name a class and provide inheritance information for it.

About this task


Identification Division.          Required
Class-id. Account inherits Base.  Required

Use the CLASS-ID paragraph to identify these classes:

  • The class that you are defining (Account in the example above).
  • The immediate superclass from which the class that you are defining inherits its characteristics. The superclass can be implemented in Java™ or COBOL.

    In the example above, inherits Base indicates that the Account class inherits methods and data from the class known within the class definition as Base. It is recommended that you use the name Base in your OO COBOL programs to refer to java.lang.Object.

A class-name must use single-byte characters and must conform to the normal rules of formation for a COBOL user-defined word.

Use the REPOSITORY paragraph in the CONFIGURATION SECTION of the ENVIRONMENT DIVISION to associate the superclass name (Base in the example) with the name of the superclass as it is known externally (java.lang.Object for Base). You can optionally also specify the name of the class that you are defining (Account in the example) in the REPOSITORY paragraph and associate it with its corresponding external class-name.

You must derive all classes directly or indirectly from the java.lang.Object class.

Related references  
CLASS-ID paragraph (Enterprise COBOL for z/OS® Language Reference)  
User-defined words (Enterprise COBOL for z/OS Language Reference)