Introduction to CICS Java environment

Source: Internet
Author: User
Tags functions pack php and web services websphere application server advantage

Brief introduction

One of the advantages of IBM CICS is that it supports multiple programming languages and allows you to mix them into one application. However, if the CICS-based application uses only Java, you want to take advantage of the various CICS JAVA environments. When passing data between CICS programs, data is typically placed in a field-oriented series byte structure so that applications written in any language can access that data. However, if you are using only the Java language, it is a good idea to put data in an object-oriented Java environment and pass Java data Objects between Ciss Java programs. This series of articles will discuss the CICS JAVA environment available in CICS TS V4.2 or its newer version, and is designed to allow Java programmers who develop CICS programs to use the environment. This series of articles is also helpful for the CICS system programmer and the CICS application programmer who started using Java.

Starting with the initial Java support of 1999, CICS is enabled to control the JVM pool, where only one Java-based CICS transaction is assigned to the JVM at a time (and therefore requires a JVM pool). In CICS TS V4.1 (June 2009), CICS introduced Jvmserver resources. The resource is a JVM in which multiple Java-based CICS transactions can be dispatched concurrently. Initially, only system functions can use Jvmserver. However, since the CICS TS V4.2 (June 2011), Jvmserver can run Java programs that use the Apache Software Foundation Open source Web service engine Axis2, and can also be used to use the Open Service Gateway Protocol (OP En Services Gateway initiative, OSGi, applications written by customers.

The June 2010 CICS TS V4.1 delivers the CICS Dynamic scripting Feature Pack, which is the implementation of Project Zero technology, which provides agile application development for situational WEB applications. The Feature Pack serves Web artifacts, supports the use of PHP and the Groovy scripting language, and has a model for quickly implementing a database that is accessible to a story application, making it easy to define and render a database table with a REST interface. The Feature Pack is implemented in CICS Jvmserver and has a bridge to Java that provides access to CICS programs and resources.

In addition to Java as a CICS server-side programming language, Java clients running in various non-CICS environments can invoke programs that run in CICS. The CICS Transaction Gateway provides a way to deliver information from Java clients to CICS using the Java Enterprise Edition (JEE) Java Connector Architecture (JCA) Expression In addition, the WebSphere optimized local Adapter (WOLA) provides a cross memory communication from WebSphere application Server to CICS, which can be in the same z/Os Logical Partition (LPAR) running.

When passing data between different Java environments provided by CICS, or passing data from a Java client program to a CICS-based program, you can use up to 32K of communication area (Commarea) or use channels and containers to deliver large amounts of data (2005 added Channels and containers). Commarea and channels are used in other field-oriented languages supported by COBOL and CICS, and these communication mechanisms enable Java programs to interact with the field-oriented language of processes running in a CICS environment. For applications implemented in the JVM environment provided by multiple CICS, the delivery object is not Java-friendly, so more steps are needed to use the CICS program to the program communication mechanism.

For example, you might want to implement java-based business logic in the OSGI environment provided by CICS to take advantage of the functionality of OSGi. You may want to display these java-based business functions as WEB services using the AXIS2 environment provided by CICS (run on different JVM servers). You may also want to use the CICS Dynamic scripting (another JVM server) to quickly provide a WEB interface to the OSGi based business logic, or to use the CICS Transaction Gateway (run in a JVM outside of CICS) Provides OSGi-based business logic access to non-CICS Java clients.

This article describes a Java-friendly way to pass objects between Java programs running in different JVMS in a CICS environment, or a Java-friendly way to pass objects between the Java environment provided by CICS in different CICS regions. This article provides background information about passing Java objects and explains the various Java environments that are provided by using CICS.

Goal

The traditional way to pass data between applications in a CICS environment is to place the data in a field-oriented series byte structure and place the structure in a commarea or CICS container in the CICS channel. The Commarea or channel is passed when the target program is invoked using the EXEC CICS LINK programs () command. There is no need to compile data for COBOL, IBM Assembler, and other CICS-enabled languages. However, for CICS-based Java programs, you must compile the Java Data Objects into a field-oriented series byte structure, or cancel the compilation of these data objects from that structure. There are utilities to generate code for compilation, and the COBOL data layout is used for input to utilities. If your CICS application uses a variety of programming languages, it is worthwhile to do something special with Java to support CICS-based Java programs that interoperate with CICS programs written in other languages.

For Java programs that run in the Java environment provided by CICS, you can use Java as usual, initialize the class, and invoke some methods. If you want to use the Java environment provided by multiple CICS to take advantage of each environment, you may want to obtain help from CICS to pass Java data. For CICS-based Java applications that span the Java environment provided by multiple CICS, you need to use a Java-friendly way to pass Java data Objects between these environments. For Java programs that access functionality provided by Java programs (in the Java environment provided by different CICS), it is easy for a Java programmer to pass data as simple as the following code snippet:

String ABC = "Some Information to pass";
Employee EMP = new Employee ("John Doe");
Ddw_cicsobjecttransporter transporter = 
    new Ddw_cicsobjecttransporter ();
Transporter.addobject ("ABC", ABC)
. AddObject ("EMP", EMP)
    . Execute ("TARGET");
    
The program return
    
String errorstring = (string) transporter.getobject ("error");
If (errorstring!= null) {
    processerror ();
} else {
    manager Newmanager = (manager) Transporter.getobject ( "Mgr");
    Process/display Manager object that is returned
}

For a response Java program that returns data, providing a response is as simple as the following, and providing a response is simple for a Java programmer:

Ddw_cicsobjecttransporter transporter = 
    new Ddw_cicsobjecttransporter ();
Employee EMP = (employee) transporter.getobject ("emp");
Work with Employee object
transporter.removeobject ("abc");    Can remove transport object
Manger mgr = new Manger ("Joe Bloggs");
Transporter.addobject ("Mgr", MGR);  Add new or changed objects return
;

Part 2nd of this series will describe how to support these use cases and provide a sample Java class named Ddw_cicsobjecttransporter to support these interactions. In addition, Ddw_cicstg_objecttransporter objects are provided when used with a transfer object between a Java client using CICS TG and a CICS TS.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.