In the past I have used BPXBATCH to execute java class files from JCL. I would like to move to using the custom JVM launcher as IBM recommends in the link below. http://www.ibm.com/developerworks/systems/library/es-java-batchz.html
I wrote up a hello world java program and compiled it on the mainframe and packaged it into a jar.
Below is an example JCL member using BPXBATCH that works.
//LMGHWRLD JOB (MY,ACCOUNTING,INFO),'HELLO WORLD',
// CLASS=A,MSGCLASS=H,REGION=512M,NOTIFY=&SYSUID
//********************************************************************
//* Run Java under a UNIX System Service shell
//********************************************************************
//STEP2 EXEC PGM=BPXBATCH,
// PARM='SH java com.foo.bar.HelloWorld'
//STDIN DD DUMMY
//STDOUT DD PATH='/tmp/&SYSUID..bpxbatch.out',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDERR DD PATH='/tmp/&SYSUID..bpxbatch.err',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDENV DD *
CLASSPATH=/u/myuid
//*********************************************************************
//* Copy HFS output files to SYSOUT, since BPXBATCH can only write
//* STDOUT and STDERR to HFS files.
//*********************************************************************
//STEP3 EXEC PGM=IKJEFT01,DYNAMNBR=300,COND=EVEN
//SYSTSPRT DD SYSOUT=*
//HFSOUT DD PATH='/tmp/&SYSUID..bpxbatch.out'
//HFSERR DD PATH='/tmp/&SYSUID..bpxbatch.err'
//STDOUTL DD SYSOUT=*,DCB=(RECFM=VB,LRECL=133,BLKSIZE=137)
//STDERRL DD SYSOUT=*,DCB=(RECFM=VB,LRECL=133,BLKSIZE=137)
//SYSPRINT DD SYSOUT=*
//SYSTSIN DD *
OCOPY INDD(HFSOUT) OUTDD(STDOUTL)
OCOPY INDD(HFSERR) OUTDD(STDERRL)
//
I would like to use all the features using the custom JVM launcher brings as detailed in the article above.
The example above executes class files, but the article seems to suggest JAR files are needed for the custom JVM launcher. Below is the job I created to try and use the custom JVM launcher.
The JAR file is ~/HelloWorld/HelloWorld.jar on OMVS.
//LMGHWRLD JOB (MY,ACCOUNTING,INFO),'HELLO WORLD',
// CLASS=A,MSGCLASS=H,REGION=0M,NOTIFY=&SYSUID
//STEP1 EXEC PGM=JVMLDM60,
// PARM='com.foo.bar.HelloWorld'
//STEPLIB DD DSN=<MY.LIBRARY.PATH>,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDENV DD *
. /etc/profile
. ~/.profile
export CLASSPATH=~/HelloWorld
for i in ~/HelloWorld/*.jar; do
export CLASSPATH=$i:$CLASSPATH
done
//
Currently the output of this job fails with a CC of 102. The specific output is below:
JVMJZBL1001N JZOS batch Launcher Version: 2.3.0 2013-05-02
JVMJZBL1002N Copyright (C) IBM Corp. 2005. All rights reserved.
JVMJZBL1038E Child shell process exited with exit code: 1
JVMJZBL1042E JZOS batch launcher failed, return code=102
My region size is 200,000 so I don't believe region size is the issue. Is there something I am doing incorrectly?
The resolution to this wound up being a change to the STDENV DD statement. The following code should work on any environment with the indicated areas changed.
//STDENV DD *
#
# Java home location
#
export JAVA_HOME=/your/omvs/path/to/java/lib
#
# Standard java path updates
#
export PATH=/bin:"${JAVA_HOME}"/bin
LIBPATH=/lib:/usr/lib:"${JAVA_HOME}"/bin
LIBPATH="$LIBPATH":"${JAVA_HOME}"/lib/s390
LIBPATH="$LIBPATH":"${JAVA_HOME}"/lib/s390/j9vm
LIBPATH="$LIBPATH":"${JAVA_HOME}"/bin/classic
export LIBPATH="$LIBPATH":
#
# Define location (and version if applicable) of jar home
#
APP_HOME=/var/location/of/your/jar
CLASSPATH=$APP_HOME:"${JAVA_HOME}"/lib:"${JAVA_HOME}"/lib/ext
# Add Application required jars to end of CLASSPATH
for i in "${APP_HOME}"/*.jar; do
CLASSPATH="$CLASSPATH":"$i"
done
export CLASSPATH="$CLASSPATH":
//
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With