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:
  • The report overview includes details about the exception type and message.
  • The event list includes Java events for the active thread, including class and methods names.
  • In individual Java events, class-method variable information and stack-frame reference variable information are not available to Z Abend Investigator, so they are not displayed.
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
messages:
Z Abend Investigator was invoked to handle a Java Throwable:
.
---------------------------------------
java.lang.ClassCastException: Cannot cast class java.util.concurrent.atomic.AtomicLong to 
class java.at java.lang.Class.cast(Class.java:2614)
at com.example.JavaUnhandled.computeTheAnswer(JavaUnhandled.java:20)
at com.example.JavaUnhandled.pureJavaUnhandledException(JavaUnhandled.java:30)
at com.example.JavaUnhandled.main(JavaUnhandled.java:41)
---------------------------------------
Calling Snap.dump to create a fault entry:
DA.DCAT(F39992)
ZAI: Passing the exception to JVM...
...