Start of change

Introducing the COBPROD application

This section introduces a simple application called COBPROD that will be used in subsequent sections when describing how to build non-OO COBOL applications that interoperate with Java™.

The COBPROD application consists of the following files:
cobprod.cbl
Java-callable COBOL program that uses the JAVA-SHAREABLE directive to identify WORKING-STORAGE data items to be shared with Java.
addlist.cbl
Java-callable COBOL program that takes an array of three java.math.BigDecimal objects, computes their sum and calls back to a Java static method to dump the result to the terminal, then returns the actual sum to the Java caller.
CobProd.java
Java program that starts the application, calls out to COBOL native method COBPROD, retrieves information from the PROD-INFO table in COBPROD's WORKING-STORAGE memory, then calls COBOL native method 'addlist'.

The COBPROD application starts on the Java side with the "main" method of the CobProd class making a call to the COBOL native method COBPROD, which initializes a Java-shareable table of product information in its WORKING-STORAGE memory. When control returns to Java, some of the prices from the product information table are collected into an array and passed to COBOL native method 'addlist', Start of changewhich sums the prices and returns to Java where the sum is displayed to the terminal.End of change

For details about the files, see Example: COBPROD application - building and running.

Next step: Preparing to compile, bind, and run non-OO COBOL applications that interoperate with Java.

End of change