Preparing and running OO applications in JCL or TSO/E

It is recommended that you run OO applications in a z/OS® UNIX environment. To run OO applications from batch JCL or TSO/E, you should therefore use the BPXBATCH utility.

In limited circumstances, however, you can run an OO application by using standard batch JCL (EXEC PGM=COBPROG) or the TSO/E CALL command. To do so, follow these requirements when preparing the application:

  • Structure the application to start with a COBOL program. (If an application starts with a Java™ program or with the main factory method of a COBOL class, you must run the application under z/OS UNIX, and the application components must reside in the z/OS UNIX file system.)
  • Link-edit considerations: Link the program object for the COBOL program into a PDSE. COBOL programs that contain object-oriented syntax must be link-edited with AMODE 31.
  • Start of changeEnsure that the class files and DLLs associated with the COBOL or Java classes that are used by the application reside in the z/OS UNIX file system. You must name the class files and DLLs as described in the related task about preparing OO applications under z/OS UNIX.End of change
  • Specify INCLUDE control statements for the DLL side files libjvm.x and igzcjava.x when you bind the object deck for the main program. For example:
    
    INCLUDE '/usr/lpp/java/IBM/J8.0/bin/j9vm/libjvm.x'
    INCLUDE '/usr/lpp/cobol/igyv6r4/lib/igzcjava.x'
    
  • Create a file that contains the environment variable settings that are required for Java. For example, a file /u/userid/javaenv might contain the three lines shown below to set the PATH, LIBPATH, and CLASSPATH environment variables.
    
    PATH=/bin:/usr/lpp/java/IBM/J8.0/bin
    LIBPATH=/lib:/usr/lib:/usr/lpp/java/IBM/J8.0/bin:/usr/lpp/java/IBM/J8.0/bin/j9vm
    CLASSPATH=.:/u/userid/applications

    To customize the initialization of the JVM that will be used by the application, you can set the COBJVMINITOPTIONS environment variable in the same file. For example, to access enterprise beans that run in a WebSphere® server, you must set the Java system property java.naming.factory.initial. For details, see the related task about running OO applications.

When you run an OO application that starts with a COBOL program by using standard batch JCL or the TSO/E CALL command, follow these guidelines:

  • Use the _CEE_ENVFILE environment variable to indicate the location of the file that contains the environment variable settings required by Java. Set _CEE_ENVFILE by using the ENVAR runtime option.
  • Specify the POSIX(ON) and XPLINK(ON) runtime option.
  • Use DD statements to specify files in the z/OS UNIX file system for the standard input, output, and error streams for Java:
    • JAVAIN DD for the input from statements such as c=System.in.read();
    • JAVAOUT DD for the output from statements such as System.out.println(string);
    • JAVAERR DD for the output from statements such as System.err.println(string);
  • Ensure that the SCEERUN2 and SCEERUN load libraries are available in the system library search order, for example, by using a STEPLIB DD statement.

Example: compiling, linking, and running an OO application using JCL

Related tasks  
Preparing OO applications under z/OS UNIX  
Running OO applications under z/OS UNIX  
Structuring OO applications  
UNIX System Services User's Guide (The BPXBATCH utility)  
Language Environment® Programming Guide (Running an application under batch)

Related references  
XL C/C++ Programming Guide (_CEE_ENVFILE)  
Language Environment Programming Reference (ENVAR)