cjbuild command reference

The cjbuild utility is provided to assist with building non-OO COBOL applications that interoperate with Java™. When the COBOL files of such an application are compiled, stub files are produced that facilitate the communication between COBOL and Java. These stub files must be built into a DLL that is available when the application runs.

Note: The cjbuild utility must be run from the z/OS® UNIX command line or from JCL using the BPXBATCH utility. However, the DLL that is produced by the utility can be targeted to an MVS™ data set or a z/OS UNIX directory.

cjbuild command usage and parameter descriptions

Execute the following command to run the cjbuild utility:

cjbuild [-hv] [-c <cobol-dir>] [-d <dll-out-dir>] [-j <java-class-dir>] [-s <java-src-dir>] [-m <PURE31|PURE64|MIX_31_64>] [-p <package-name>] <methods-file> <app-name>
where:
<methods-file>
The methods file is a file that contains a list of COBOL programs that have been compiled with the JAVA-CALLABLE and/or JAVA-SHAREABLE directives and a list of static Java methods that are called from COBOL programs in the application using a CALL statement of the form:
CALL 'Java.<java-class-name>.<java-static-method-name>'
These programs have associated stub files located in the directory indicated by the --coboldir option that will be compiled into a DLL for the application.
Programs compiled with the JAVA-CALLABLE directive will be grouped into a class called 'progs' in the specified package (see -p option), and data items that fall under the scope of a JAVA-SHAREABLE directive in any of the listed COBOL programs will be grouped into a class called 'strg' in the specified package.
For example, the contents of the methods file for an application consisting of two Java-callable COBOL programs COBPROG1 and COBPROG2, one of which makes a call to a static Java method 'Java.com.acme.MyClass.myMethod' would look as follows:

     COBPROG1
     COBPROG2
     Java.com.acme.MyClass.myMethod
<app-name>
Used to create the name of the DLL that contains the stub code needed at run time by the interoperable application (both Java and COBOL may need this DLL).
For example, if the app name is appl, then the DLL will be called libapp1.so, if the argument to the -d option is a z/OS UNIX directory, or will be called LIBAPP1, if the argument to the -d option is an MVS PDS data set.
See the following table for the options in cjbuild command reference:
Table 1. Options and descriptions
Options Descriptions
--coboldir <cobol-dir>
-c <cobol-dir>
Path to COBOL artifact directory. This directory contains files generated by the compiler when compiling COBOL programs that contain the JAVA-CALLABLE and/or JAVA-SHAREABLE directives or CALL statements with a literal call target of the form 'Java.java-class-name.java-static-method-name'.".

Default: current directory

--dlloutdir <dll-out-dir>
-d <dll-out-dir>
Path where the DLL of stub code is to be placed. For a PDS, use the path of the form:
//<DATASET-NAME>
For example:
//COBOL.LOAD or //'USER.COBOL.LOAD'

Default: current directory

--help
-h
Displays verbose help.

Default: N/A

--javaclassdir <java-class-dir>
-j <java-class-dir>
Path to location of output class files for generated Java code. This path should be in your CLASSPATH environment variable.

Default: current directory

--javasrcdir <java-src-dir>
-s <java-src-dir>
Path to location of output Java source files.

Default: current directory

--mode <PURE31|PURE64|MIX_31_64>
-m <PURE31|PURE64|MIX_31_64>
Java/COBOL interoperability mode.

Specify PURE31 for AMODE 31 COBOL/31-bit Java application.

Specify PURE64 for AMODE 64 COBOL/64-bit Java application.

Specify MIX_31_64 for AMODE 31 COBOL/64-bit Java application.
Note: You must build COBOL files with JAVAIOP(JAVA64) option for MIX_31_64 mode applications.

Default: PURE31

--pkgname <package-name>
-p <package-name>
Name of package with which these native methods will be associated. Each application should have its own package name.
For example:
com.acme.COBOL.myapp1
Three classes will be created as part of this package:

     com.acme.COBOL.myapp1.cobol
     com.acme.COBOL.myapp1.progs
     com.acme.COBOL.myapp1.strg

Default: enterprise.COBOL

--verbose
-v
Verbose output. Shows compile/link commands executed.

Default: N/A

Related references  
JAVA-CALLBALE (Enterprise COBOL for z/OS Language Reference)    
JAVA-SHAREABLE (Enterprise COBOL for z/OS Language Reference)
CALL statement (Enterprise COBOL for z/OS Language Reference)