Sample 6 (HFZSJAV6): Call a Java batch application with the Z Abend Investigator wrapper utility

The JCL in sample HFZ.SHFZSAM1(HFZSJAV6) demonstrates how to use the Z Abend Investigator Java™ wrapper utility to invoke a Java class with a main() method within a try-catch block. Unhandled exceptions are automatically caught and fault entries are created using the Snap.dump() method.

When you use the wrapper utility to catch unhandled Java exceptions, only a limited amount of Java information is available to Z Abend Investigator: See Java information reporting limitations for additional information.

See Invoking the Z Abend Investigator wrapper for details about invoking the wrapper utility.

Example output from the Z Abend Investigator wrapper utility

The wrapper utility reports the class being invoked and any command line arguments that were specified. For example:

Z Abend Investigator Java Wrapper
Invoking class: com.example.JavaUnhandled
with args: ’[pureJavaUnhandledException]’
When ZAI catches an unhandled exception, the ZAI wrapper displays the following
Z Abend Investigator was invoked to handle a Java Throwable:
java.lang.ClassCastException: Cannot cast class java.util.concurrent.atomic.AtomicLong to 
class java.lang.Class.cast(
at com.example.JavaUnhandled.computeTheAnswer(
at com.example.JavaUnhandled.pureJavaUnhandledException(
at com.example.JavaUnhandled.main(
Calling Snap.dump to create a fault entry:
ZAI: Passing the exception to JVM...