Exercise 1.1: Selecting the resource adapter
This tutorial leads you through the detailed steps to generate a J2C application that processes variable length and multiple segment IMS
transaction output messages.
Before you can begin this tutorial, you must first obtain the required resources:
- Information about your IMS: In this tutorial, your application interacts with an IMS application program in IMS. You need
to obtain information such as the host name and port number of IMS Connect and the name of the IMS datastore where the transaction
will run. Contact your IMS systems administrator for this information. Specifically, you need to perform
some setup work in IMS if you want to run the IMS\MultiSegmentOutput IMS program. This information is
provided below.
- A copy of the COBOL file MSOut.cbl You may locate this file in your product installation directory: \rad\eclipse\plugins\com.ibm.j2c.cheatsheet.content_6.0.0\samples\IMS\MultiSegmentOutput.
If you wish to store it locally, you can copy the code from here: MSOut.cbl
- A clean workspace.
NOTE: The IMS transaction that is used in this tutorial is not one of the IMS Installation
Verification Programs. This tutorial uses DFSDDLT0, an IMS application program that issues calls to IMS based on control statement
information. The DFSDDLT0 control statements for this tutorial are provided below. However, to run this tutorial you must configure your
environment for DFSDDLT0 and provide the necessary JCL. This tutorial uses SKS2 as the transaction code for the DFSDDLT0 application.
DFSDDLT0 control statements
S11 1 1 1 1 TP 1
L GU
E OK
E Z0017 DATA SKS2 M2 SI1M3 SI1
WTO SEGMENT SI1 RECEIVED
L GN
E QD
WTO END OF INPUT SEGMENTS
L ISRT IW06OUT
L Z0012 DATA *******M1SO1
E OK
WTO SEGMENT SO1 INSERTTED
L ISRT
L Z0027 DATA ********M1SO2*********M2SO2
E OK
WTO SEGMENT SO2 INSERTTED
L ISRT
L Z0048 DATA **********M1SO3***********M2SO3************M3SO3
E OK
WTO SEGMENT SO3 INSERTTED
WTO CURRENT PROGRAM STLDDLT2 TERMINATED
L GU
This tutorial uses COBOL data structures to describe the IMS transaction input and output messages. Note that the output message
returned by IMS consists of three fixed length segments:
- OUTPUT-SEG1 (16 bytes)
- OUTPUT-SEG2 (31 bytes)
- OUTPUT-SEG3 (52 bytes)
The output message returned by this particular IMS application is a fixed size of 99 bytes and is represented by the COBOL 01 structure
OUTPUT-MSG.
One way of developing this multi-segment application is to use the COBOL definition OUTPUT-MSG to define the output of the transaction.
A second way is to create an output message for the output of the transaction. The code provided with this tutorial uses the second method,
since it can also be used to build an application that processes a variable length output message. The COBOL definitions for the individual
message segments will continue to be used to simplify access to the data of the individual segments.
Selecting the resource adapter
Switching to the J2EE Perspective
If the J2EE icon,
, does not appear in the
top right tab of the workspace, you need to switch to the J2EE perspective.
- From the menu bar, select Window > Open Perspective > Other. The Select Perspective window opens.
- Select J2EE.
- Click OK. The J2EE perspective opens.
Connecting to the IMS server
- In the J2EE perspective, select File > New > Other.
- In the New page, select J2C > J2C Java Bean. Click Next
Note: If you do not see the J2C option in the wizard list, you need to Enable J2C Capabilities.
- From the menu bar, click Window > Preferences.
- On the left side of the Preferences window, expand Workbench.
- Click Capabilities. The Capabilities pane is displayed. If you would like to receive a prompt when a feature is first used that requires an enabled capability, select Prompt when enabling capabilities.
- Expand Enterprise Java.
- Select Enterprise Java. The necessary J2C capability is now enabled. Alternatively, you can select the Enterprise Java capability folder to enable all of the capabilities that folder contains. To set the list of enabled capabilities back to its state at product install time, click Restore Defaults.
- To save your changes, click Apply, and then click OK. Enabling Enterprise Java capabilities will automatically enable any other capabilities that are required to develop and debug J2C applications.
In the Resource Adapters Selection page, select either the J2C 1.0 or J2C 1.5 IMS resource adapter. For this tutorial select IMS
Connector for Java (IBM : 9.1.0.1.2). Click Next.
In the Connection Properties page, clear the Managed Connection check box and select Non-managed Connection.
(For this tutorial, you will use a non-managed connection to directly access IMS, so you do not need to provide a JNDI name.) Accept the default Connection class name of
com.ibm.connector2.ims.ico.IMSManagedConnectionFactory. In the blank fields, provide all the required connection information.
Required fields, indicated by an asterisk (*), include the following:
For TCP/IP connection:
- Host name: (Required) The IP address or host name of IMS Connect.
- Port Number: (Required) The number of the port used by the target IMS Connect.
For local option connection:
- IMS Connect name: (Required) The name of the target IMS Connect.
For both:
- Data Store Name: (Required) The name of the target IMS datastore.
You may obtain the connection information from your IMS system administrator. When you have provided the required connection
information, click Next.
Now you are ready to begin Exercise 1.2: Setting up the Web project and Java Interface and Implementations .