DATA DIVISION for defining a client

You can use any of the sections of the DATA DIVISION to describe the data that the client needs.


Data Division.
Local-storage section.
01  anAccount        usage object reference Account.
01  aCheckingAccount usage object reference CheckingAccount.
01  aCheck           usage object reference Check.
01  payee            usage object reference Account.
. . .

Because a client references classes, it needs one or more special data items called object references, that is, references to instances of those classes. All requests to instance methods require an object reference to an instance of a class in which the method is supported (that is, either defined or available by inheritance). You code object references to refer to instances of Java™ classes using the same syntax as you use to refer to instances of COBOL classes. In the example above, the phrase usage object reference indicates an object reference data item.

All four object references in the code above are called typed object references because a class-name appears after the OBJECT REFERENCE phrase. A typed object reference can refer only to an instance of the class named in the OBJECT REFERENCE phrase or to one of its subclasses. Thus anAccount can refer to instances of the Account class or one of its subclasses, but cannot refer to instances of any other class. Similarly, aCheck can refer only to instances of the Check class or any subclasses that it might have.

Another type of object reference, not shown above, does not have a class-name after the OBJECT REFERENCE phrase. Such a reference is called a universal object reference, which means that it can refer to instances of any class. Avoid coding universal object references, because they are interoperable with Java in only very limited circumstances (when used in the RETURNING phrase of the INVOKE class-name NEW . . . statement).

You must define, in the REPOSITORY paragraph of the CONFIGURATION SECTION, class-names that you use in the OBJECT REFERENCE phrase.

related references  
RETURNING phrase (Enterprise COBOL for z/OS® Language Reference)