420 IMS Connectivity in an On Demand Environment: A Practical Guide to IMS Connectivity
Example 21-14 shows an example of SQL INSERT for a prepared statement.
Example 21-14 SQL INSERT statement for prepared statement
INSERT INTO CustomerDB.OrderTable(OrderNo, OrderName)
VALUES (?,?)
WHERE CustomerTable.CustomerNo = ?
Supported JDBC data types
IMS Java supports the JDBC data types listed in Table 21-2. The table also lists the
supported Java data types and how COBOL copybook types are mapped to it for JDBC type.
You can use several different Java methods to handle Java data types. For mapping
descriptions, see IMS Version 9: IMS Java Guide and Reference, SC18-7821.
Table 21-2 Supported JDBC data types
21.3 DLIModel utility
In order for a Java application to access an IMS database, it needs information about the
database. This information is contained in the PSBs and DBDs, but you must first convert this
information into a form that you can use in the Java application: a subclass of the
com.ibm.ims.db.DLIDatabaseView class called the
IMS Java metadata class. The DLIModel
utility generates this metadata from the IMS PSBs, DBDs, COBOL copybooks, and other
JDBC data type Java data type COBOL format
CHAR string PIC X
CLOB CLOB (supported only for IMS
XML database)
N/A
VARCHAR string PIC X
BIT Boolean N/A
TINYINT byte N/A
SMALLINT short From PIC 9(1) BINARY
To PIC 9(4) BINARY
INTEGER int From PIC 9(5) BINARY
To PIC 9(9) BINARY
BIGINT long From PIC 9(10) BINARY
To PIC 9(18) BINARY
FLOAT float COMP-1
DOUBLE double COMP-2
BINARY byte[] N/A
PACKEDDECIMAL java.math.BigDecimal PIC 9 COMP-3
ZONEDDECIMAL java.math.BigDecimal PIC 9 DISPLAY
DATE java.sql.Date N/A
TIME java.sql.Time N/A
TIMESTAMP java.sql.Timestamp N/A
Chapter 21. IMS Remote Database Services 421
input specified by utility control statements. In addition to creating the metadata class, this
utility also generates XML schemas of IMS databases. These schemas are used when
retrieving XML data from or storing XML data in IMS databases. In this section, we focus on
the metadata creation function of the DLIModel utility and provide a sample operation
procedure. For complete information about the DLIModel utility, see IMS Version 9: Utilities
Reference: System, SC18-7834.
Figure 21-7 shows the inputs and outputs from the DLIModel utility.
Figure 21-7 DLIModel utility inputs and outputs
The actions of the DLIModel utility are directed by control statements that you supply. The
control statements can specify:
Which PSB to process during a run
Aliases for the PSB, PCBs, segments, and fields
Data types and format masks for fields
XMI files that contain XMI descriptions of COBOL copybook members for segments
Additional field definitions for fields that are not defined in the DBD or the COBOL
copybook XMI file
Information that overrides PSB, DBD, and COBOL copybook XMI information
Default values for newly inserted segments
The DLIModel utility reads the PSB and DBD source members from the partition data set
(PDS) or partition data set extended (PDSE) and parses them to build an in-memory model of
the database structure and the PSB view of that structure. The utility then generates the
outputs that were requested through control statements. You can specify an XMI description
of the entire in-memory model in which one description covers the PSB and all DBDs
processed in the run. You can also request a detailed trace file of the DLIModel utility
execution if such a trace is necessary for problem resolution.
After you create a metadata class from a PSB, you can install the metadata class as a
Datasource in WebSphere Application Server environment. The relationship between
metadata class and Datasource is mapped by Java Naming and Directory (JNDI) API. A Web
application in WebSphere Application Server for z/OS or distributed platforms will use JNDI to
make the specific ODBA connection to the IMS database manager.
PSB Source
(PDS)
DBD Source
(PDS)
COBOL XMI
(PDS or HFS)
Control
Statements
DLIModel
Utility
DLIModel
Java Report
(HFS)
Trace
(HFS)
XMI
(HFS)
MetaData
Class
(HFS)
DB Connection sample of Web Application
Context ctx = new InitialContext();
DataSource dds =
(DataSource)ctx.lookup(“java:comp/env/jdbc/CustomerDBView”);
Connection con = dds.getConnection();
J2C Connection
Factory Registration
(JNDI)

Get IMS Connectivity in an On Demand Environment: A Practical Guide to IMS Connectivity now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.