Migrating applications from version 1.x to version 2.0
You can migrate your existing PHP applications from CICS® Dynamic Scripting Feature Pack Version 1.x to Version 2.0. Applications that are written
in Groovy cannot be migrated to Version 2.0.
Before you begin
Before you can migrate an application from version
1.x, the following conditions must be satisfied:
The CICS TS Feature Pack for Dynamic Scripting V2.0 z/OS® components are installed and customized.
The CICS TS5.6with Java EE and Liberty target platform definition is available in the IBM® CICS SDK for Java™.
You understand how to create and deploy bundles in CICS.
A IBM CICS SDK for Java session is
started.
For more information about OSGi and how it is implemented in CICS, see The OSGi Service Platform. For more information about packaging
applications and deploying them in a JVM server, see the CICS
Java Developer Guide in the IBM CICS SDK for Java help.
About this task
Previous versions of the CICS TS Feature Pack for Dynamic Scripting use technology that is based on
IBM
WebSphere® sMash. The CICS TS Feature Pack for Dynamic Scripting version 2.0 is based on the CICS Liberty JVM server. PHP applications that were developed by
using previous versions can be migrated to version 2.0, but because Liberty is an OSGi environment
you must repackage existing PHP applications as enterprise bundle archives (EBAs) to deploy them to
Liberty.
Procedure
Perform these steps for each application you want to migrate:
Copy the PHP files from your existing application into the OSGi bundle with web support created
in step 1.
If the application uses technology specific to sMash, such as Dojo, zput(), zget(), zero
configuration files, and RESTful services, you must change your PHP code to use only standard
features.
If you run Java code in CICS, you must migrate it to the Liberty JVM server as OSGi bundles. You do this outside the
scope of migrating PHP applications. If your Java code is
referenced from within a PHP application, you must import the Java bundle in the manifest file of the web application bundle (WAB).
If any other web assets, such as JavaScript
libraries or CSS files, are served as part of the PHP application from the public directory, copy
them into the OSGi bundle with web support created in step 1.
If your application uses Groovy code, you must rewrite it to Java code. Rewriting Groovy code to Java code is
straightforward. See the following example:
Figure 1. A simple Groovy script
class HelloWorld {
def greet( name ){
"Hello ${name}!"
}
}
def hm = new HelloWorld()
println hm.greet("Groovy")
Figure 2. The Java equivalent of the Groovy script
package your_package;
public class HelloWorld {
public String greet(String name){
return "Hello " + name;
}
public static void main(String[] args) {
HelloWorld hm = new HelloWorld();
System.out.println(hm.greet("Groovy"));
}
}