Sample RESTful web application for deployment to a Liberty JVM server in CICS. The application is supplied with two resources:
InfoResource
- This queries the JVM server environment using system properties and uses JAXB beans to return a JSON response detailing the CICS environment.ReverseResource
- This is similar toInfoResource
, but uses the JCICS API to link to the COBOL programEDUCHAN
using channels and containers. An input string is passed toEDUCHAN
, which is then reversed and returned, along with the time from CICS.
The following Java source components are supplied in the src/main/java
directory in this repository.
CICSApplication
- Sets theApplicationPath
for resources in this applicationInfoResource
- Returns JSON structure usingCICSInformation
beanReverseResource
- Returns JSON structure usingReverseResult
bean
CICSEnvironment
- JAXB bean returning JSON structure containing information about CICS product and versionCICSInformation
- JAXB bean returning JSON structure containing CICS applid, time and JVM server name and instance ofCICSEnvironment
ReverseResult
- JAXB bean returning JSON structure containg input and output containers sent toEDUCHAN
COBOL program
DFHCSD.txt
- Output from a DFHCSDUP EXTRACT for the CICS BUNDLE resource definition.EDUCHAN.cbl
- A sample CICS COBOL that returns the date and time and reversed input using channels and containersbuild.gradle
- A sample Gradle build file to enable an automated build of the deployable WARpom.xml
- A sample Maven build file to enable an automated build of the deployable WAR
- CICS TS V5.1 or later, due to the usage of the
getString()
methods. - Java SE 1.8 or later on the workstation
- Eclipse with the IBM CICS SDK for Java EE, Jakarta EE and Liberty, or any IDE that supports usage of the Maven Central artifact com.ibm.cics:com.ibm.cics.server.
The sample Java classes are designed to be added to a dynamic web project and deployed into a Liberty JVM server as a WAR, either using the dropins directory or using a CICS bundle project.
- Using an Eclipse development environment create a dynamic web project called
com.ibm.cicsdev.restapp
and add the Java samples to thesrc
folder - Add the CICS Liberty JVM server libraries to the build path of your project.
- Ensure the web project is targeted to compile at a level that is compatible with the Java level being used on CICS. This can be achieved by editing the Java Project Facet in the project properties.
- Create a CICS bundle project called
com.ibm.cicsdev.restapp.cicsbundle
and add a dynamic web project include for the project created in step 1.
The sample can be built using the supplied Gradle or Maven build files to produce a WAR file and optionally a CICS Bundle archive.
Run the following in a local command prompt:
gradle clean build
This creates a WAR file inside the build/libs
directory and a CICS bundle ZIP file inside the build/distributions
directory.
If using the CICS bundle ZIP, the CICS JVM server name should be modified in the jvmserver
property in the gradle build properties file to match the required CICS JVMSERVER resource name, or alternatively can be set on the command line as follows.
gradle clean build -Pjvmserver=MYJVM
Run the following in a local command prompt which will create a WAR file for deployment.
mvn clean verify
This creates a WAR file in the target
directory.
If building a CICS bundle ZIP the CICS bundle plugin bundle-war goal is driven using the maven verify phase. The CICS JVM server name should be modified in the property in the pom.xml
to match the required CICS JVMSERVER resource name, or alternatively can be set on the command line as follows.
mvn clean verify -Djvmserver=MYJVM
- Enable Java support in the CICS region by adding the
SDFJAUTH
library to theSTEPLIB
concatenation and settingUSSHOME
and theJVMPROFILEDIR
SIT parameters.- This step is not required if using CICS 5.5 or later
- Define a Liberty JVM server called
DFHWLP
using the supplied sample definitionDFHWLP
in the CSD groupDFH$WLP
. - Copy the CICS sample
DFHWLP.jvmprofile
zFS file to theJVMPROFILEDIR
directory specified above and ensure theJAVA_HOME
variable is set correctly. - Add the
jaxrs-1.1
(or later version) Liberty feature toserver.xml
depending on your version of Java EE. - Install the
DFHWLP
resource defined in step 2 and ensure it becomes enabled.
- Using the CICS Explorer export the CICS bundle project to a zFS directory. The samples use the directory
/u/cics1/com.ibm.cicsdev.restapp.cicsbundle_1.0.0
. - Create a CICS BUNDLE definition referencing the zFS directory created in step 1.
- Install the CICS BUNDLE resource.
- Download and compile the supplied COBOL program
EDUCHAN
and deploy into CICS.
Note: A sample DFHCSDUP input file for the required CICS BUNDLE resource definition is supplied in the supporting file DFHCSD.txt file.
This will invoke the InfoResource
class and return the following JSON response with information about the target CICS system:
{"applid":"IYK2Z32E","jvmServer":"DFHWLP","time":"2016-09-09T16:19:55.384Z","cicsEnvironment":{"cicsProduct":"CICS Transaction Server for z/OS","cicsVersion":"5.3.0"}}
This will invoke the ReverseResource
class which links to the CICS COBOL program and reverses the default string "Hello from Java" returning the following JSON response:
{"time":"2016-09-09T16:15:52.756Z","original":"Hello from Java","reverse":"avaJ morf olleH","truncated":false}
This will invoke the ReverseResource
class which links to the CICS COBOL program reversing the input string "ilovecics" as follows:
{"time":"2016-09-09T16:15:32.466Z","original":"ilovecics","reverse":"scicevoli","truncated":false}