RETURNING phrase for obtaining a returned value
If a data item is to be returned
as the method result,
specify the item in the RETURNING
phrase of the INVOKE
statement.
Define the returned item in the DATA DIVISION
of
the client.
The item that you specify
in the RETURNING
phrase
of the INVOKE
statement must conform to the type
returned by the target method, as shown in the table below.
Programming language of the target method | Is the returned item an object reference? | Then code the DATA DIVISION definition
of the returned item as: |
---|---|---|
COBOL | No | The same as the definition of the RETURNING item
in the target method |
Java™ | No | Interoperable with the returned Java data item |
COBOL or Java | Yes | An object reference that is typed to the same class as the object reference that is returned by the target method |
In all cases, the data type of the returned value must be one of the types that are interoperable with Java.