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/--coboldir <cobol-dir>]
               [-d/--dlloutdir <dll-out-dir>]
               [-i/--progid <program-id>] ...
               [-j/--javaclassdir <java-class-dir>]
               [-m/--mode PURE31|PURE64|MIX_31_64]
               [-p/--pkgname <package-name>]
               [-r/--jar <jar-file>]
               [-s/--javasrcdir <java-src-dir>]
               [<program-file>] <lib-base-name>
where:
Start of change<program-file>End of change
Start of change
Note: This argument was called <methods-file> in previous versions of cjbuild and was a mandatory argument. It is now optional.
End of change
Start of changeOptional input file containing a list of COBOL programs in the interoperable application whose stub files in the COBOL artifact directory (indicated by the -c/--coboldir option) are to be processed by cjbuild. When <program-file> is not specified, and -i is also not specified, all stub files in the directory are processed. The programs listed should be those programs in the application that have interoperability features, such as the >>JAVA-CALLABLE directive, the >>JAVA-SHAREABLE directive, or CALL statements of the form:
CALL 'Java.<java-class-name>.<java-static-method-name>'
Programs compiled with the >>JAVA-CALLABLE directive will be grouped into a class called 'progs' in the specified package (see -p), and data items that fall under the scope of a >>JAVA-SHAREABLEdirective 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 program 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
End of change
Start of change
<lib-base-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). This name is also used as the base name for the .jar file created when the -r/--jar option is not specified and the .jar file name defaults. For example, If <lib-base-name> is app1, then the DLL will be called libapp1.so if the argument to the -d option is a z/OS UNIX directory, or LIBAPP1 if the argument to the -d option is an MVS PDS data set. The .jar file created when the --jar <jar-file> option is not specified is libapp1.jar.
End of change
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

Start of change--progid <program-id>
-iEnd of change
Start of change

Indicates the name of a COBOL program whose stub files in the directory indicated by the -c/--coboldir option are to be processed by cjbuild.

The option can be specified multiple times, once for each program to be included in cjbuild's processing. It is similar to the <program-file> argument, which serves the same purpose, but -i allows you to provide the same information to cjbuild on the command line instead of in an input file.

<program-id> corresponds to the name of the COBOL program as specified in the program-id clause of the program. If the name is specified without quotes in the COBOL program, then the name should be specified with all upper case letters in the -i option. If the name is specified as a literal in the COBOL program, then the case of characters specified in the -i option should match exactly with the program-id clause in the COBOL program.

Default: N/A

End of change
--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

Start of change--jar <jar-file>
-rEnd of change
Start of change

Create a Java .jar file from any .class files generated from compiling Java source files produced by the COBOL compiler and cjbuild. The .jar file will have the name as indicated by the <jar-file> argument.

The .jar file should be in your Java CLASSPATH at run time.

Default: a jar file with name lib<lib-base-name>.jar is created in the current directory.

End of change
--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)