Using the Z Abend Investigator Java wrapper utility

Z Abend Investigator Java wrapper utility wraps a callable Java application in a try-catch block by using the FA Java class.

The try-catch block traps any unhandled exceptions from the Java application and calls Z Abend Investigator using the com.hcl.zai.Snap.dump method.

Usage

If using a version of Java JVM earlier than version 11:

Copy the HFZXJAVA jar file as binary to an HFS or zFS directory:

//* --- Copy HFZXJAVA to an HFS or zFS directory:
//CPYXJAVA EXEC PGM=BPXBATCH
//STDPARM DD *
SH cp "//'HFZ.SHFZDOC1(HFZXJAVA)'" /u/hunter2/hfzxjava.jar
/*
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
If using a Java JVM version 11 or later:

Copy the HFZXJA11 jar file as binary to an HFS or zFS directory:

//* --- Copy HFZXJA11 to an HFS or zFS directory:
//CPYXJAVA EXEC PGM=BPXBATCH
//STDPARM DD *
SH cp "//'HFZ.SHFZDOC1(HFZXJA11)'" /u/hunter2/hfzxjava.jar
/*
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*

Invoking the Z Abend Investigator wrapper

You can call the wrapper utility through the command line or as part of a batch job (JCL).

Use either of the following commands to invoke the wrapper utility from a command line application:

If using a version of Java JVM earlier than version 11:
  • java -jar hfzxjava.jar <clsName> <mainArgs>

    or

  • java -cp hfzxjava.jar FA <clsName> <mainArgs>
If using Java JVM version 11 or later:
  • java -jar hfzxja11.jar <clsName> <mainArgs>

    or

  • java -cp hfzxja11.jar FA <clsName> <mainArgs>
For a Java batch application that is invoked using BPXBATCH:
If using a version of Java JVM earlier than version 11:
//* --- Launch a batch Java application with
//* --- Z Abend Investigator wrapper
// EXPORT SYMLIST=*
// SET HFSDIR=<target directory>
//CPYXJAVA EXEC PGM=BPXBATCH
//STDENV DD *
JAVA_HOME=/usr/lpp/java800/31bit/J8.0/ &&
PATH=${PATH}:${JAVA_HOME}/bin
CLASSPATH=/u/hunter2/classes
/*
//STDPARM DD *
SH java -jar /u/hunter2/hfzxjava JavaApp arg1 arg2
/*
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
If using Java JVM version 11 or later:
//* --- Launch a batch Java application with
//* --- Z Abend Investigator wrapper
// EXPORT SYMLIST=*
// SET HFSDIR=<target directory>
//CPYXJAVA EXEC PGM=BPXBATCH
//STDENV DD *
JAVA_HOME=/usr/lpp/java800/31bit/J8.0/ &&
PATH=${PATH}:${JAVA_HOME}/bin
CLASSPATH=/u/hunter2/classes
/*
//STDPARM DD *
SH java -jar /u/hunter2/hfzxja11 JavaApp arg1 arg2
/*
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*

Z Abend Investigator passes the specified arguments to the main method of the user application. Any specified Java properties and environment variables are available to the user application as normal.

When an unhandled exception occurs, the resulting fault entry contains information about the Java event.

Figure 1. Sample event summary showing use of the Java wrapper utility

<H1> E V E N T   S U M M A R Y


The following events are presented in chronological order.

Event           Fail  Module   Program  EP
#  Type         Point Name     Name     Name     Event Location (*) Description
-- ------------ ----- -------- -------- -------- ------------------ ---------------------------------------
 1 JavaExc            n/a      n/a      Driver.main
                                                 L#4                From file:/u/testfa1/Driver.class