z/OS Batch Runtime Planning and User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Commit and Rollback Callbacks

z/OS Batch Runtime Planning and User's Guide
SA23-1376-00

The z/OS® Batch Runtime coordinates updates to data through commit and rollback operations. When an application needs to commit or rollback a transaction, the batch runtime is called to initiate the activity. This is done through Java™ callbacks to the batch container.

The batch container provides two Java helper methods that must be invoked by the application:
  • Commit: com.ibm.batch.spi.UserControlledTransactionHelper.commit()
  • Rollback: com.ibm.batch.spi.UserControlledTransactionHelper.rollback()

Because these helper methods are written in Java, the PL/I application must use the Java Native Interface (JNI) to call them. The batch runtime will document a sample that shows how to do this but will not deliver any PL/I sample code.

PL/I provides a mapping of the JNI functions which are needed to invoke Java methods in the %ibmzjni.inc include member. The PL/I application then invokes a series of JNI calls to find the helper method and invoke it.

This process is described generally below and is followed with an example:
  1. Obtain the JNIEnv pointer (which is needed to access JNI functions) using the JNI_GetCreatedJavaVMs function
  2. Invoke the FindClass JNI function to locate the com.ibm.batch.spi.UserControlledTransactionHelper class
  3. Invoke the GetStaticMethodID JNI function to locate the commit or rollback methods
  4. Invoke the CallStaticVoidMethod JNI function to invoke the commit or rollback method located above

It is likely the PL/I application will already have similar code due to interoperability since the process is the same when invoking any Java method.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014