When an issue occurs with your z/OS Java application, you can debug your application with various tools provided to you by the z/OS Java Virtual Machine (JVM).

For more information about these tools, please see the section titled “Overview of the available diagnostic tools” in the z/OS User Guide for IBM SDK, Java Technology Edition. Here is a link to the IBM SDK 8.0.0 version of this guide

After some investigation, if you believe that the issue involves the JZOS toolkit or the JZOS batch launcher, you may turn on additional debug tracing/logging in the JZOS components.

JZOS provides logging mechanisms with the following levels of granularity:

    E: Only error level messages are emitted
    W: Adds warning level messages
    N: Adds notice level messages (the default logging setting)
    I: Adds informational messages
    D: Adds debugging level messages
    T: Adds trace level messages

Although this logging capability is available in both JZOS toolkit and JZOS batch launcher, their logging levels are independent from each other. This means that you can configure one level of logging granularity for the JZOS toolkit and a different level for the JZOS batch launcher.

Configure JZOS toolkit native library logging

To configure the logging level for the JZOS toolkit, use the optional jzos.logging system property when starting the JVM. This property controls logging in the JZOS toolkit native library.

When starting Java under the USS environment, add -Djzos.logging=[level] after the java command to set the logging level of the JZOS toolkit, where level is one of E, W, N, I, D, T.

When starting Java under the traditional z/OS batch environment, use the IBM_JAVA_OPTIONS environment variable to set the logging level for the JZOS toolkit. To demonstrate, let’s build upon our insurance payee example from the prior session. We used a JCL called JVMJCL86 to run our Java application in z/OS batch. Open that JCL and add the following export command to our STDENV configuration script:

IJO=”$IJO -Djzos.logging=T”

This will set the JZOS toolkit logging level to T, which is the most detailed trace option available.

After this change, our STDENV configuration script should look like the following:


//STDENV DD *

# This is a shell script which configures

# any environment variables for the Java JVM.

# Variables must be exported to be seen by the launcher.

 

. /etc/profile

export JAVA_HOME=/home/javaft1/javaonz/java/J8.0_64

 

export PATH=/bin:"${JAVA_HOME}"/bin

 

LIBPATH=/lib:/usr/lib:"${JAVA_HOME}"/bin

LIBPATH="$LIBPATH":"${JAVA_HOME}"/lib/s390x

LIBPATH="$LIBPATH":"${JAVA_HOME}"/lib/s390x/j9vm

LIBPATH="$LIBPATH":"${JAVA_HOME}"/bin/classic

export LIBPATH="$LIBPATH":

 

# Customize your CLASSPATH here

APP_HOME=/home/javaft1/javaonz/Insurance/bin

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":

 

# Set JZOS specific options

# Use this variable to specify encoding for DD STDOUT and STDERR

#export JZOS_OUTPUT_ENCODING=Cp1047

# Use this variable to prevent JZOS from handling MVS operator commands

#export JZOS_ENABLE_MVS_COMMANDS=false

# Use this variable to supply additional arguments to main

#export JZOS_MAIN_ARGS=""

 

# Configure JVM options

IJO="-Xms16m -Xmx128m"

IJO="$IJO -Djzos.logging=T"

# Uncomment the following to aid in debugging "Class Not Found" problems

#IJO="$IJO -verbose:class"

# Uncomment the following if you want to run with Ascii file encoding..

#IJO="$IJO -Dfile.encoding=ISO8859-1"

export IBM_JAVA_OPTIONS="$IJO "

 

If we re-run our Java application, the SYSOUT output DD should now contain details of each data set operation being performed by the JZOS native code on the JAVAFT1.HIGHRISK.DATA.PAYEE data set.

Debug jzos application

Configure JZOS batch launcher logging

If there is an issue preventing your Java application from being launched by the JZOS batch launcher, it will be helpful to get a detailed log of the launcher. To configure the logging level for the JZOS batch launcher, use the LOGLVL='[level]’ parameter when executing the JVMPRC86 PROC (remember the number 86 in JVMPRC86 stands for Java 8.0 64-bit. The filename will be different if you’re using a different version of Java) from within your JCL, where level is one of +E, +W, +N, +I, +D, +T.

Open your JVMJCL86 JCL and add the following parameter to the JVMPRC86 PROC call:

// LOGLVL=’+T’

This will set the JZOS batch launcher logging level to T, which is the most detailed trace option available.

After this change, our JVMPRC86 PROC call should look like the following:

//JAVA EXEC PROC=JVMPRC86,

// JAVACLS='ReadPayeeData',

// ARGS='JAVAFT1.HIGHRISK.DATA.PAYEE',

// LOGLVL='+T'

If we re-run our Java application, the SYSOUT output DD should now contain detail log of the JZOS batch launcher.

Debug application

Refer to JZOS Installation (chap 3 pg8 and pg 10) for more information.

Join The Discussion

Your email address will not be published. Required fields are marked *