Sharing data with Java

You can share the COBOL data types that have Java™ equivalents. (Some COBOL data types have Java equivalents, but others do not.)

About this task

Share data items with Java in these ways:

  • Pass them as arguments in the USING phrase of an INVOKE statement.
  • Receive them as parameters in the USING phrase from a Java method.
  • Receive them as the RETURNING value in an INVOKE statement.
  • Return them as the value in the RETURNING phrase of the PROCEDURE DIVISION header in a COBOL method.

To pass or receive arrays and strings, declare them as object references:

  • Declare an array as an object reference that contains an instance of one of the special array classes.
  • Declare a string as an object reference that contains an instance of the jstring class.