Java in dynamic scripting applications
Dynamic scripting applications can contain PHP scripts that call native Java™ functions, in addition to the JCICS Java library, to interact with CICS® assets. You can explicitly commit or roll back units of work by using JCICS methods in your applications.
Using Java in dynamic scripting applications
<?php
java_import("com.ibm.cics.server.Region");
echo "Your CICS Dynamic Scripting Example (PHP) is now running in CICS Region " . Region::getAPPLID() . ".";
?>
You can use the JCICS API to interact with CICS assets. However, a small subset of the JCICS API is not supported. For more information, see Restrictions.
When you use JCICS, be aware of potential encoding issues. For more information, see Character encoding in dynamic scripting applications.
Custom Java
- Package your Java classes with the PHP files. These classes can then be accessed directly by the PHP run time.
- Package the Java classes into another OSGi bundle and export them in the MANIFEST.MF file. You can then use these classes in your PHP application by importing this OSGi bundle.
Explicitly committing and rolling back units of work
Dynamic scripting application tasks are subject to CICS committing and rolling back work in units of work (UOW). You can also use JCICS to explicitly commit or roll back units of work in your applications. Scripts can explicitly commit and roll back units of work at any point while they are running, by starting methods Task.getTask().commit() and Task.getTask().rollback(). For more information, see JCICS class reference.