General Page
Introduction
Using Java to modernize legacy applications or develop new business logic enables you to leverage the skills that are common in the distributed world environment.
In addition, you might lower the cost of running applications by taking advantage of
IBM Z specialty processor engines, which assist in lowering the chargeable MIPs usage when processing Java.
So where are the Java applications that access IMS?
It depends… They can be running on distributed, on z Systems, or cloud platforms. These applications can access IMS databases or Db2 for z/OS. Some Java applications access IMS through IMS Connect APIs, through the TM resource adapter, or through WebSphere servers. Some run within the same LPAR as WebSphere or CICS.
IMS is two products in one. It’s both a database and a transaction manager, so how you implement and deploy your Java applications can vary.
This section provides some basic getting-started information with Java. For a deep dive into architecture, design, and development considerations, as well as insights and samples for adopting and integrating Java to maximize and extend your IMS business applications, see:
New! Supercharge IMS Business Applications with Java (PDF, June 2021 edition)
This book contains insights in the entire Java integration and adoption process based upon various enterprise application integration and modernization projects with IMS customers. In this August 2017 edition, a case study chapter based on a recent modernization project at Fiducia & GAD IT AG is added. From functional requirements, infrastructure landscape, environment settings, application development, to security considerations, this chapter provides great insight into the thought process, with information that you will find helpful with your own modernization project.
IMS provides address spaces to execute system and application programs that use IMS services.
These address spaces are called dependent regions. You could think of these as layers in a container.
These regions can be either message driven, that is,applications that process messages that come into IMS TM as input, or batch regions.
IMS dependent regions support persistent JVMs to provide the capability to efficiently make calls that interoperate between Java and languages such as COBOL and PL-one. This enables the capability to leverage existing IMS applications as well as extend functionality using Java.
Set up
This article assumes that the necessary environment for the Java application that accesses IMS Database has been set up in advance. A brief description of the set up has been provided depending on the type of access for the Java application.
The question you need to have answered is:
- Does the Java app reside on z/OS on the same LPAR as the IMS database? Also referred to as “Local Access”
- Does the app reside on a different z/OS LPAR OR on a non-z/os(example Windows, linux or unix) platform? Also referred to as “Distributed Access”
Depending on the answer to the question above, make sure that the set up has been completed.
Use the Interactive Diagrams to understand what roles are involved in implementing the solutions
Local Access Set up
New Interactive Diagram showing an example of implementing Java in IMS Solution
IMS Dependent Region Set up
Obtain the IMS Java Dependent region adapter and IMS Universal JDBC drivers. These are available as IMS Java components during installations. Details on how to get these files is described here under IMS Java On Demand Features
Make sure that the IMS region where the Java program is going to run has been set up, it is either Java Message Processing JMP or Java Batch Processing JBP.
IMS provides address spaces to execute system and application programs that use IMS services. These address spaces are called dependent regions. Learn more about IMS dependent regions here.
How to set up the z/os environment for Java applications running in IMS
Capture the database metadata class for the IMS Database
The Database metadata Java class is necessary because it describes the IMS PSBs, DBDs, segments, fields, relationships and data type information. If IMS Catalog has been set up, the database metadata is automatically captured, however it may still need to be enhanced.
IMS Explorer for Development is used to capture JDBC metadata so that IMS terms are mapped to relational making queries easier to model
PCB->Schema, Segment->Table,
Field->Column, Record->Row
IMS Explorer for Development is a no-charge product that installs on Windows operating system, downloadable from Download Page.
To learn how to capture JDBC metadata for an IMS Database, watch this tutorial video.
Model Input and Output Messages for IMS Transaction Manager
When input and output messages to IMS Transaction Manager are developed in Java, they need to be mapped so that TM understands how to process them.
It is important to note here that this video here describes input output messages for IMS Transaction manager to access an IMS database (not DB2 database). Learn the basics of Message queue processing for IMS TM and map the messages.
Distributed Access Set up
New Interactive Diagram showing an example of implementing Open Access Solution
- Set up open access infrastructure and optionally set up IMS catalog. Note that IMS catalog is not absolutely required but is recommended so that JDBC programming is easier.
More details on how to set up the infrastructure needed on z/OS in order to allow distributed access is documented here and setting up IMS Catalog has been documented here - Capture the database metadata class as described above
- Obtain the IMS Universal JDBC Drivers and the Universal Database Resource Adapters available as a web download here
- Use IMS Explorer for Development to Visualize the database and model queries to be used in the Java application
To learn more regarding the set up for Distributed or open access to IMS DB, watch these video tutorials.
Write the application
In order to write the Java application, the IMS universal JDBC drivers, Java dependent region adapter and database resource adapter file are present on your development system.
Use standard JDBC programming to develop the program
Let’s say the database in question is an insurance database and the use case is to find information on all the policies for a certain customer
This translates to an SQL query “SELECT FIRSTNAME, LASTNAME, CUST_STREET, CUST_CITY, CUST_STATE, CUST_ZIPCODE, DATEOFBIRTH FROM INSURPCB.CUSTOMER WHERE CUSTOMERNUMBER = ?”
Let’s say this insurance database has three types of policies for every customer, life, home and auto.
then you would use this for auto policy for example
PreparedStatement autoPolicyStatement = conn.prepareStatement(“SELECT POLICYNUMBER, CAR_MAKE, CAR_MODEL, CAR_MANUFACTUREDATE, CAR_REGNUMBER, CAR_DRIVERNAME FROM INSURPCB.POLICY WHERE CUSTOMER_CUSTNO = ? and POLICYTYPE=’A'”);
And for home insurance policy
PreparedStatement housePolicyStatement = conn.prepareStatement(“SELECT POLICYNUMBER, HOMEPROPERTYTYPE, HOMEBEDROOMS, HOMEHOUSEVALUE, HOME_STREET, HOME_ZIPCODE FROM INSURPCB.POLICY WHERE CUSTOMER_CUSTNO = ? and POLICYTYPE=’H'”);
Complete source code is provided in the code samples section.
Watch this video to learn how to develop an application that sends input message to IMS TM, queries IMS DB and returns output message.
IMS Explorer for Development is a great tool to visualize IMS database. In the Set up section, you have downloaded and installed E4D. You can use it to connect to a live DB to explore, visualize and query.
When you are using the Distributed Access method, where your program is running outside of z, you have to have the infrastructure enabled. If you are using the Local Access method, you may still want to ask a Systems Programmer or DBA to set up the infrastructure so that you can visualize and Query. Watch these videos to learn how to use E4D to explore
and model SQL queries.
Once you have the application ready, get ready to deploy. If using the local access method, application is deployed on z/os using standard methods.
Deploy
Watch this video to learn how application is deployed and tested.
In order to Deploy application for Distributed access watch the videos Deploy IMS Resource Adapters and Develop JEE application that accesses IMS DB
Videos show how to deploy using the database resource adapters. The sample code used for the Insurance use case has been provided. This is a sample server.xml file used for Websphere liberty server that shows database resource adapters being added.
Was this topic helpful?
Document Information
Modified date:
25 August 2021
UID
ibm16321803
