You are on page 1of 26

®

IBM Software Group

IMS and WebSphere
June 2005

Alan Cooper
Pan-EMEA Technical Sales
alan_cooper@uk.ibm.com

IBM Software Group | DB2 Information Management Software

Agenda

ƒ What is IMS?

ƒ WebSphere and IMS Transactions

ƒ WebSphere and IMS Databases

IMS and WebSphere - June 2005 Page 2

1

IBM Software Group | DB2 Information Management Software

What is IMS?

IMS and WebSphere - June 2005 Page 3

IBM Software Group | DB2 Information Management Software

What is IMS?
ƒInformation Management System

A Data Base Manager
AND For the z/OS Platform
A Transaction Manager

¾ Use either or both

IMS DB can be used with IMS TM and/or CICS
IMS TM can use IMS DBs and/or DB2 databases

IMS and WebSphere - June 2005 Page 4

2

IBM Software Group | DB2 Information Management Software IMS Early History ƒ IMS was designed and written jointly by IBM and Rockwell in the mid to late 1960s IMS/360 announced in 1968 ƒ Objective was to provide an accessible repository for storing information about the several million parts that go to make a Saturn V rocket Part of Apollo Lunar Space Mission ƒ The Saturn V parts database was inherently hierarchical (components made of assemblies made from ….37th Year Anniversary Internet Access Local or remote JDBC Access and still leading the industry !!! 2005+ Extended Terminal > 21000 Trans/sec Concurrent (with z990) Option (ETO) Image Copy > 1000 Transactions IMSplex operator interface Per Second APPC/IMS Remote Site Multiple Systems Coupling Shared Message Queues Recovery (MSC) Data Base Local Hot Standby Concurrent Update From Multiple User/ DBMS (XRF) . terminals were start/stop devices on BTAM networks IMS and WebSphere .June 2005 Page 5 IBM Software Group | DB2 Information Management Software 2005 .June 2005 Page 6 3 .. System Parallel Systems Exploit MP 2-way Data Sharing N-Way Batch Architecture Data Sharing DBMS Two Phase Commit Deadlock Detection z990 1968 Magnetic storage 1977 System 3033 System/360 IMS and WebSphere . made from elemental parts) So IMS databases are Hierarchical DBs ƒ In those days..

June 2005 Page 7 IBM Software Group | DB2 Information Management Software IMS DB Terminology Up to 15 levels and ƒ DB Hierarchy 255 segment types ƒ Segment ƒ Levels EMPLOYEE NO.June 2005 Page 8 4 . 7M per hour handled by another customer  21. 6 ƒ Root / Dependent EMPLOYEE NAME 30 Level 1 EMPLOYEE ƒ Parent / Child (44 bytes) DEPARTMENT 2 DATE HIRED 6 Level 2 GROSS SALARY 6 ADDR SALARY CLASS 3 ADDRESS LINE (S) SALARY AUTH DATE 6 O-n (15 bytes) (25 bytes) Level 3 TAXES DEDUCT (21 bytes) (12 bytes) IMS and WebSphere . IBM Software Group | DB2 Information Management Software IMS Today ƒ Most Corporate Data is Managed by IMS  Over 95% of Fortune 1000 Companies use IMS  IMS Manages over 15 Million GBs of Production Data  $2.000 Trans/sec (near 1 Billion/day) with IMS Data/Queue Sharing on a single processor with database updates  6000 Trans/sec across TCP/IP to single IMS ƒ IMS Revenue is approaching $1Billion per year – and growing  Currently about 10% growth per annum  MIPS growth is even faster IMS and WebSphere .5 Trillion/day transferred through IMS by one customer ƒ Over 50 Billion Transactions a Day run through IMS  IMS Serves Close to 200 Million Users a Day  Over 100 Million IMS Trans/Day Handled by One Customer  120M IMS Trans/day.

June 2005 Page 10 5 . (e. IBM Software Group | DB2 Information Management Software IMS DB Terminology … No defined limit on number of segments in a ƒ DB Record record or number of records in a DB ƒ Twins Root EMPLOYEE Segment A Twins Twins SALARY ADDRESS B2 D2 B1 D1 Twins Twins TAXES C12 DEDUCT C23 C11 C22 C21 IMS and WebSphere .g. IMS provides an algorithmic technique for locating root segments by key ƒ Segment hierarchic relations are maintained by control information (pointers) in segment headers  Not seen by applications ƒ Secondary indexes can be set up to access any segment directly ƒ Two or more physical DBs with data in common can be “joined” to provide a logical DB  statically managed by IMS The TheIMS IMSDB DBManager Manageroffers offersthe themost mostcost-effective cost-effectiveand andefficient efficient way wayofofstoring storingand andaccessing accessingdata data •• Ideal Idealfor forhigh highperformance performanceproduction productionsystems systems •• But Butless lessflexible flexibleand anddynamic dynamicthan thanrelational relationalDBs DBs(e.DB2) DB2) IMS and WebSphere .g.June 2005 Page 9 IBM Software Group | DB2 Information Management Software IMS DB Fundamentals ƒ IMS DBs are stored on DASD ƒ They can be partitioned (up to 1001 partitions) ƒ Some implementations use a primary index to access roots by key ƒ Alternatively.

PARENT=SALARY SENSEG NAME=DEDUCT . PARENT=SALARY represented by a PCB PCB TYPE=DB .. PROCOPT=G SENSEG NAME=SALARY . BYTES=15 . DBDNAME=PROJECT . BYTES=6 . BYTES=18 . SEQ .June 2005 Page 11 IBM Software Group | DB2 Information Management Software IMS XML DB Support ƒ An extension of the IMS Java JDBC functions IMS DB You have the option IMS PSB/DBD of Source • accessing a standard IMS DB record as an XML DLIModel IMS Java document (and Utility Application v. BYTES=4 . END replace. PROCOPT=G . BYTES=5 . . PSBNAME=EMPLPROJ How they can be accessed (get.v. BYTES=44 . START=20 search fields (fields used as search criteria) SEGM NAME=SALARY . PSBGEN LANG=COBOL . BYTES=12 . IBM Software Group | DB2 Information Management Software IMS DB Metadata ƒ Physical (and Logical) DB is described by a “control block” called a DBD (Data Base Descriptor) DBD NAME=EMPLOYEE .. KEYLEN=22 (Program Communication Block) SENSEG NAME=PROJECT . PCBNAME=EMPDB…. PARENT=EMPLOYEE . ACCESS=HDAM. PARENT=SALARY SEGM NAME=DEDUCT . DATASET DD1=EMPLDATA Defines segments and their hierarchy SEGM NAME=EMPLOYEE . START=1 Defines segment key (sequence) fields and FIELD NAME=FULNAME . Which segments . PARENT=0 FIELD NAME=(SERIAL . BYTES=21 . insert. START=5 • Other fields are optional SEGM NAME=TAXES . DBDNAME=EMPLOYEE ..June 2005 Page 12 6 .) Or • Storing/accessing XML Schema XML Document an XML document intact in an IMS DB IMS and WebSphere . START=1 . PROCOPT=GR • Each DB view is named and SENSEG NAME=TAXES . Which DBs SENSEG NAME=EMPLOYEE . delete) IMS and WebSphere . U) . PARENT=SALARY Defines secondary index access paths FIELD NAME=TYPE . PARENT=EMPLOYEE FIELD NAME=RATE . END ƒ An application’s view of one or more DBs is defined by a PSB (Program Specification Block) PCB TYPE=DB .

C.June 2005 Page 14 7 . WebSphere. IMS and WebSphere . REGION COBOL. FORTRAN. multiple addresses spaces (upto ~1000) each with multiple tasks Transaction programs (MPPs) are loaded and deleted on demand by the IMS control region Batch programs (called “BMPs”) can also be run concurrently Upto 999 Program Dependent Regions languages supported are CONTROL DBRC DLISAS MPPs BMPs Assembler. PASCAL IMS RECON DB and PL/1 Log MESSAGE QUEUES IMS and WebSphere .June 2005 Page 13 IBM Software Group | DB2 Information Management Software IMS TM Architecture ƒ Highly Parallel Architecture In z/OS terminology. Java. IBM Software Group | DB2 Information Management Software IMS Transaction Manager ƒ IMS TM is a Queueing System  All input messages (transactions) and reply (output) messages are secured (logged to make them recoverable) on an IMS queue before being acknowledged and processed ƒ Terminal/network control characters are removed by IMS before queueing an input message. MQ. Terminal/network control characters are added by IMS before sending application-created reply message Transaction application programs are Device Independent  The same program can be used to service messages from any SNA terminal. etc. TCP/IP terminal.

and incremental growth DBs Allows continuous user service over Allows continuous unscheduled user service and scheduled over outages unscheduled and scheduled outages IMS and WebSphere .June 2005 Page 15 IBM Software Group | DB2 Information Management Software IMS Connectivity ƒ BTAM was eventually replaced by VTAM (SNA)  IMS provided specific support for several different SNA LU types • LU0. of availability. SLU2.2 (APPC) ƒ Other “network clients” required access to IMS  Especially TCP/IP and MQ ƒ IMS provided a general purpose access facility – OTMA  Open Transaction Manager Access  Defines a messaging protocol ƒ TCP/IP access is provided by IMS Connect  Performs protocol conversion between TCP/IP and OTMA ƒ MQ access uses the MQ Bridge feature of WebSphereMQ  Bridges between MQ queues and IMS OTMA IMS and WebSphere .June 2005 Page 16 8 . SLU1. IBM Software Group | DB2 Information Management Software IMSPlex ƒ Multiple IMS systems can run together in multiple z/OS systems to create a single system VTAM Generic Resources image VTAM VTAM VTAM  Shared Databases IMS1 CTL IMS2 CTL IMS3 CTL Coupling  Shared Queues CQS CQS CQS Facility  Shared Systems Shared Queues Management Functions CQS = Common Dependent Dependent Dependent Queue Server Regions Regions Regions Provides highest possible levels of Provides highest availability. workload incremental growth balancing. LU6. possible workload levelsand balancing.1 (ISC) and LU6.

CALL “CBLTDLI” USING …… ƒ DL/I Calls  Used to access message queues  Used to access IMS DBs ƒ SQL Calls are used to access DB2 ƒ Java applications can use DL/I-like methods...g. IBM Software Group | DB2 Information Management Software IMS Connectivity … WebSphere DB2 EJBs CICS Std Procs CICS JDBC Open DB DB2 DB2 IMS Database Manager Access Stored (ODBA) Procedures Application Application .June 2005 Page 18 9 . known as DL/I (data language interface)  Often called “DL/1” or data language one  E. but JDBC is available and recommended  JDBC provides SQL access to IMS DB (and DB2) in IMS java programs IMS and WebSphere . Application IMS Operations Transaction IMS Message Queues Manager Manager (OM) Open Transaction Structured Call IMS Data Comm. Manager Access (OTMA) Interface (SCI) Common Interface (XCF) PC call SNA/Network MQSeries IMS Connect RYO (TCP/IP or local) IMS and WebSphere . APPC Comm.June 2005 Page 17 IBM Software Group | DB2 Information Management Software IMS Application Programming Interfaces ƒ The traditional API was a standard CALL facility.

June 2005 Page 20 10 . available. reliable and secure IMS and WebSphere .Customer Wants and Needs ƒ Increased return on existing investments improved reuse of legacy assets simplified access & better integration with WebSphere Application Server ƒ Lower total cost of ownership improved AD productivity easier systems management ƒ Solutions which are scalable. IBM Software Group | DB2 Information Management Software Open Data Base Access (ODBA) ƒ Provides a callable interface to IMS databases from any z/OS programs that are not managed by IMS Managed by z/OS RRS ƒ Typical examples include – Any Application z/OS using RRS  DB stored procedures O D IMS D DBCTL or B  WebSphere EJBs or servlets Any Application using RRS B TM/DB A R C DLISAS ƒ z/OS provides the sync point manager Any Application using RRS  Resource Recovery Services (RRS) DBs IMS and WebSphere .June 2005 Page 19 IBM Software Group | DB2 Information Management Software E-Business On Demand .

IBM Software Group | DB2 Information Management Software IMS TM/DB – Fulfilling these Needs ƒ IMS Strategy  Easier Systems Management (Common Service Layer. etc)  Exploit new programmer skills (IMS Java)  Enhanced connectivity and integration  Improved development productivity provided by WebSphere Studio (Application Developer Integration Edition and Enterprise Developer) IMS and WebSphere . Dynamic Resource Definition.)  Availability and capacity (Shared Queues.June 2005 Page 22 11 .June 2005 Page 21 IBM Software Group | DB2 Information Management Software WebSphere and IMS Transactions IMS and WebSphere . IMSPlex. etc.

META estimates J2EE is utilized by at least 80% of the Global 2000. IMS and WebSphere . IBM Software Group | DB2 Information Management Software Accessing IMS TM from the Internet ƒ Direct access from end-user devices via TCP/IP  Via IMS Connect or MQBridge ƒ Web Server Access  Initially.June 2005 Page 24 12 . a variety of solutions and associated tools. were made available to enable CGI programs (and equivalents) to submit IMS transactions  But customers demanded to be told the “IBM recommended solution”  IBM’s response was “Use Java Servlets” • Tooling and connectors were made available  Then came J2EE architecture. Many are ” turning to Java 2 platform Enterprise Edition (J2EE) technology as the foundation for their web-based applications.June 2005 Page 23 IBM Software Group | DB2 Information Management Software J2EE Server Model Web Web Container EJB Container JDBC / JCA Resource Adapters Browser IMS TM Client Graphic Here HTTP / HTTPS Servlets RMI / IIOP EJBs IMS DB JSPs (or other J2EE Core Services EIS) “ Doing business on the Web continues to be a top priority for companies worldwide. and a new recommendation appeared – • “Use EJBs to access IMS TM” IMS and WebSphere .

IBM Software Group | DB2 Information Management Software IMS Connector for Java (IC4J) ƒ A J2EE Connector Architecture (JCA) resource adapter ƒ Used to develop and run J2EE application that access IMS transactions via IMS Connect ƒ Offers a highly scalable and flexible topology ƒ Supports rapid application development with WebSphere Studio Application Developer Integration Edition ƒ Runs in WebSphere Application Server on both z/OS and distributed platforms ƒ Shipped with RAD (was WSADIE) for Also known as development platform. Web Solaris.June 2005 Page 26 13 .June 2005 Page 25 IBM Software Group | DB2 Information Management Software J2EE Connector Architecture with IMS WebSphere Application Server (z/OS. zLinux) Component Enterprise Bean CCI Application Contract O Managers: SPI IMS T IMS TM System Connect M Contracts IMS X A • Transaction Connector T C • Connection for Java C F • Security P DB / DB I P IMS and WebSphere . AIX. and with • IMS Resource Adapter IMS Connect for deployment platform • WebSphere Adapter for IMS IMS and WebSphere . Linux. Windows.

request type.June 2005 Page 28 14 . etc.June 2005 Page 27 IBM Software Group | DB2 Information Management Software Creating an EJB for IMS Transaction Access ƒ Use the tooling provided in RAD import a transaction’s COBOL. IMS and WebSphere . timeout value. C or MFS source that defines the input and output message layouts define the IMS transaction as an IMS Enterprise Service • a sequence of panels gathers information about the IMS transaction − TCP/IP data about IMS Connect − Default user security information − Default IOPCB values for LTERMname and MODname − Commit mode. IBM Software Group | DB2 Information Management Software Features of IC4J with IMS Connect ƒ Provides full support for -  Distributed two phase commit between EJB and IMS transaction (optional)  Secure Sockets (optional)  Timeouts  Connection Pooling  Container and Component Managed Sign-on ƒ Supports a variety of IMS options Distributed Two  Commit modes 0 and 1 Phase Commit  Conversational or non-conversational z/OS processing T IMS WAS C IMS IMS Control Region EJB DBRC Address Space Connect P OTMA DLI SAS XCF XMem XMem EJB / I User Exit User Exit User Exit EJB P IMS and WebSphere .

. INPUTMESSAGE Use methods of Java Classes 1 INPUTMESSAGE to build the LookupNameProxy proxy = new LookupNameProxy().. Issue TCP/IP socket calls to . input message bean Call input format handler to convert INPUTMESSAGE input = new INPUTMESSAGE()...setIn_ll(18)..send transaction Java . IMS and WebSphere .. Java classes representing the input and output messages • Objects of these classes are the message beans • Methods for setting and getting fields in the message beans 2. output..setIn_trancode("LOOKUP").getOut_lastname() .. 3 input bean to IMS msg byte stream OUTPUTMESSAGE output = new OUTPUTMESSAGE().get reply 9 TCP/IP Remove headers from reply or Web Services Invocation Local Option Framework (WSIF) parses 6 8 WSDL and uses it to IMS 7 determine how to Connect XCF IMS dynamically call the service IMS and WebSphere .. calls the “run transaction” method of the proxy. 11 Use methods of .setIn_person_number("015771").runLookUpName(input)... Connector for 5 . Java Format Handler classes • Providing methods for converting between Message beans and IMS messages (byte streams) 3. 1 input. etc. and handles the reply .June 2005 Page 30 15 . IBM Software Group | DB2 Information Management Software Creating an EJB for IMS Transaction Access … ƒ RAD generates three things 1.. /* build input message bean */ Unit test Execute “Run transaction” input. Service definition created in Web Service Description Language (WSDL) ƒ Still using RAD  Use the WSDL Editor (if needed) to specify additional parameters which will be passed when calling the IMS EJB • User security data. the class which contains the method that is executed to run the IMS transaction  write and run a java test program that puts values into the input message fields. LTERMname for IOPCB.June 2005 Page 29 IBM Software Group | DB2 Information Management Software Creating an EJB for IMS Transaction Access … ƒ Use RAD to test the components of the Enterprise Service  create the java proxy..getOut_firstname() .setIn_zz(0). output... Timeout values.. program 2 method of proxy Java proxy 10 Call output format handler to convert IMS output msg to an output bean input... CCI 4 Build OTMA headers Build IMS Connect header (IRM) /* display output in RAD console window */ IMS 11 .... OUTPUTMESSAGE OUTPUTMESSAGE to retrieve WSIF WSDL /* execute transaction */ the fields of the reply message 2 output = proxy. input.

... WSIF Se a g g d . EJB TCP/IP yReturn reply message /* INPUTMSG class */ or java test or setIn_ll() . and handles the reply IMS and WebSphere . yBuild OTMA headers /* retrieve response from reply bean*/ yBuild IMS Connect header IMS Connector . yRemove reply headers Servlet... and packages all the generated components in an Enterprise Archive (EAR) file ƒ Use RAD to test the EJB create the EJB proxy. ( runLookUpName() . IMS IMS XCF /* OUTPUTMSG class */ Connect getOut_lastname() . yAccept input message . setIn_person_number() ... I/I input. Local Option setIn_zz() .June 2005 Page 31 IBM Software Group | DB2 Information Management Software Invoking the Transaction via an EJB .. m i.setIn_trancode("LOOKUP")........ WSDL message beans yCall OUTPUTMSG output = new OUTPUTMSG().. output.... RM ed ns liz a ) ia e be ata input..getOut_lastname() .setIn_ll(18).. calls the “run transaction” method of the proxy......runLookUpName(input)..getOut_firstname() .June 2005 Page 32 16 . output.. WSIF INPUTMSG input = new INPUTMSG()..setIn_person_number("015771"). the class which contains the method that is executed to run the IMS transaction Reuse the java test program that puts values into the input message fields. s s /* EJB Proxy class */ es m /* execute transaction */ . program setIn_trancode() . output = proxy... LookupNameEJBProxy proxy = new LookupNameEJBProxy().. r input. IMS and WebSphere . getOut_firstnam() ......e.setIn_zz(0).... IBM Software Group | DB2 Information Management Software Creating an EJB for IMS Transaction Access … ƒ Use RAD to generate the EJB for the IMS Enterprise Service generate the “deploy” code for EJB access to the IMS transaction service • RAD builds an EJB and additional WSDL. (IRM) .... for Java yIssue socket calls ... /* build input message bean */ P EJB Format IO Handlers input.....

runLookUpName(input).. r tes vlet... IBM Software Group | DB2 Information Management Software Creating a Web Service for the IMS Transaction ƒ Use RAD to generate a Web Service from the IMS Enterprise Service generate the “deploy” code for SOAP access to the IMS transaction service • RAD builds an EJB (if not already done) and additional WSDL. Format P EJB OA /* build input message bean */ Handlers input. ...... WSIF XM /* SOAP Proxy class */ /* execute transaction */ . . sending.. WSIF INPUTMSG input = new INPUTMSG().. receiving. and parsing the SOAP XML documents Reuse the java test program that puts values into the input message fields.. the class which contains the method that is executed to run the IMS transaction • encapsulates the details of writing..setIn_person_number("015771").. c...June 2005 Page 34 17 .. and handles the reply IMS and WebSphere ..... yBuild OTMA headers /* retrieve response from reply bean*/ IMS yBuild IMS Connect header ..... S input... yAccept input message . WSDL message beans yCall OUTPUTMSG output = new OUTPUTMSG()..getOut_firstname() . input. calls the “run transaction” method of the proxy... E TCP/IP yReturn reply message t pr ogr JB..June 2005 Page 33 IBM Software Group | DB2 Information Management Software Invoking the Transaction as a Web Service . getOut_firstnam() .. and packages all the generated components in an Enterprise Archive (EAR) file ƒ Use RAD to test the Web Service create the SOAP proxy. yIssue socket calls Se Java yRemove reply headers ..setIn_trancode("LOOKUP").. IMS and WebSphere . output.... setIn_person_number() .. runLookUpName() ...setIn_zz(0). ja /* INPUTMSG class */ or setIn_ll() ..... et a Local Option setIn_trancode() . Connector for (IRM) ... L input. output. output = proxy.setIn_ll(18)....getOut_lastname() . am v setIn_zz() . IMS IMS XCF /* OUTPUTMSG class */ Connect getOut_lastname() .. LookupNameSOAPProxy proxy = new LookupNameSOAPProxy().

IBM Software Group | DB2 Information Management Software WebSphere and IMS Data Bases IMS and WebSphere .June 2005 Page 36 18 .June 2005 Page 35 IBM Software Group | DB2 Information Management Software Access to IMS DBs from WebSphere ƒ Servlets can use JDBC to access IMS DBs  When WAS and IMS are in same z/OS IM ƒ EJBs can use JDBC to access IMS DBs S Ad JD ap BC  When WAS and IMS are in same z/OS ter s a Res re ou typ rce  When WAS V5 is on a different platform from IMS e3 • Requires latest release of IMS (Version 9) • Requires WAS V5 for z/OS as well as distributed WAS Windows / AIX / Solaris z/OS Distributed WAS WAS for z/OS EJB EJB IMS IIOP over SSL EJB IMS IMS DBs Distributed OR (CM) O JDBC JDBC D Resource B Adapter EJB Resource XMem (BM) Adapter A IMS and WebSphere .

dbaib. Setup is documented in the “IMS Java Guide and Reference” (SC18-7821-02 for V9) IMS and WebSphere . JDBC  A standard Java API for accessing relational databases or tabular data sources (e.com/ims) for distributed WAS platform  Deploy the two IMS provided EJBs on WAS for z/OS  Install Distributed JDBC Resource Adapter and special data source in JNDI • At runtime. spreadsheets) from Java applications  Enables sending of SQL statements to a database and processing the tabular data returned (the “result set”) But But how how do do we we map map aa hierarchical hierarchical DB DB onto a relational DB structure? onto a relational DB structure? IMS and WebSphere . the client application’s data source properties will be propagated to an instance of this data source. IBM Software Group | DB2 Information Management Software EJB Access to IMS Data Base ƒ WAS z/OS Setup  Install IMS JDBC Resource Adapter (using supplied . ssalist) in WAS programs JavaToDLI.ioArea.June 2005 Page 37 IBM Software Group | DB2 Information Management Software IMS Java for IMS Database Processing ƒ IMS Java includes classes to enable “DL/I calls” to be written by the programmer  Two levels available. high and low Not permitted connection.June 2005 Page 38 19 . namely .rar file) • Provided with IMS distribution files  Add load library to WAS for z/OS JCL • Containing executables that enable WAS to use ODBA / IMS  Install WAS Custom Service • To connect to IMS ODBA at WAS startup and disconnect at WAS shutdown ƒ Distributed WAS Setup  Download additional IMS Java files from IMS Web Site (ibm.getBytes()) ƒ But it is always recommended to use the Java standard technique.g.execute("GU".ssa.getUniqueSegment (mySegment .

IMS and WebSphere .*.. 53SJ9 | Mary | 111 Penny Lane 53SJ9 Mary 111 Penny Ln. . . MODEL. 53SJ7 | George | 555 Bailey Ave. . each field is a column Relational Design Hierarchical Design Dealer Table DealerID DealerName DealerAddress Dealer 53SJ7 George 555 Bailey Ave.June 2005 Page 39 IBM Software Group | DB2 Information Management Software JDBC SQL with IMS Java DEALER ƒ A segment/table is implicitly joined with MODEL SALESPER all the segments/tables up the hierarchical ORDER SALES STOCK SALESINF path to the root segment/table Selected columns (SELECT) and selection criteria (WHERE) can refer to any columns up the hierarchy to the root • In fact.. .. IBM Software Group | DB2 Information Management Software Hierarchical to Relational Mapping DEALER MODEL SALESPER ƒ Segment type maps to a table ORDER SALES STOCK SALESINF  Each segment is a row. .. it is strongly recommended to specify WHERE criteria for all tables (segments) up to the root “SELECT … FROM ORDER” automatically selects the parent MODEL and DEALER segments with each ORDER segment selected • SELECT * FROM ORDER only returns columns from ORDER • Use SELECT DEALER.June 2005 Page 40 20 .. DealerID Name Address Segment 53SJ8 Bob 240 Elm St. 53SJ8 | Bob | 240 Elm St....* FROM MODEL to return all columns of both DEALER and MODEL IMS and WebSphere .... . Implicit Relational JOIN Model JPR27 | Dodge | Durango Segment WJ45 | Mercury | Cougar Model Table UU45 | Dodge | Viper ID Make Model DealerID PR27 | Dodge | Durango UU45 Dodge Viper 53SJ7 FF13 | Toyota | Camry PR27 Dodge Durango 53SJ7 ID Make Model FF13 Toyota Camry 53SJ7 JR27 Dodge Durango 53SJ8 WJ45 Mercury Cougar 53SJ8 ....

DLITypeInfo.ims.dealership JavaName=DealerNo FIELD Name=DLRNAME JavaName=DealerName //****************************** FIELD Name=CITY JavaName=DealerCity // PSB + PCB Definitions FIELD Name=ZIP JavaName=DealerZip //****************************** FIELD Name=PHONE JavaName=DealerPhone PSB psbName=AUTPSB11 JavaName=AUTPSB11DatabaseView SEGM DBDName=AUTODB SegmentName=MODEL PCB pcbName=AUTOLPCB JavaName=Dealer JavaName=ModelSegment PCB pcbName=AUTS1PCB JavaName=Order FIELD Name=MODKEY JavaName=ModelKey PCB pcbName=AUTS2PCB JavaName=DealerStock FIELD Name=YEAR JavaName=Year PCB pcbName=AUSI2PCB JavaName=SecIndx2 FIELD Name=MSRP JavaType=PACKEDDECIMAL PCB pcbName=EMPLPCB JavaName=EmployeePCB TypeQualifier=999999.1).CHAR. "PHONE") }.. it is taken from the DB2 Catalogue  For IMS DB.PDS.CHAR.5) }. (HFS) additional fields IMS and WebSphere . "ZIP").. "DLRNAME"). 1.99 JavaName=MSRP Java PCB names metadata IMS and WebSphere . 5.dealership generated for PSB: AUTPSB11 IMS Java ================================================== PCB: Dealer ================================================== Segment: DealerSegment Field: DealerNo Type=CHAR Start=1 Length=4 ++ Primary Key Field ++ Field: DealerName Type=CHAR Start=5 Length=30 (Search Field) Field: DealerCity Type=CHAR Start=35 Length=10 (Search Field) Field: DealerZip Type=CHAR Start=45 Length=10 (Search Field) Field: DealerPhone Type=CHAR Start=55 Length=7 (Search Field) ================================================== Report Segment: ModelSegment Field: ModelKey Type=CHAR Start=3 Length=24 ++ Primary Key Field ++ Field: ModelType Type=CHAR Start=1 Length=2 (Search Field) Field: Make Type=CHAR Start=3 Length=10 (Search Field) Field: Model Type=CHAR Start=13 Length=10 (Search Field) Field: Year Type=CHAR Start=23 Length=4 (Search Field) Field: MSRP Type=CHAR Start=27 Length=5 (Search Field) Field: Count Type=CHAR Start=32 Length=2 (Search Field) (HFS) ================================================== Segment: OrderSegment Field: OrderNo Type=CHAR Start=1 Length=6 ++ Primary Key Field ++ Field: LastName Type=CHAR Start=7 Length=25 (Search Field) Field: FirstName Type=CHAR Start=32 Length=25 (Search Field) Field: Date Type=CHAR Start=57 Length=10 (Search Field) Field: Time Type=CHAR Start=67 Length=8 (Search Field) ================================================== Segment: SalesSegment Field: SaleNo Type=CHAR Start=49 Length=4 ++ Primary Key Field ++ . 45. new DLITypeInfo("DealerZip".ROOT).AUTO //****************************** DBDds=SAMPLE.AUTOLPCBDEALERArray. IBM Software Group | DB2 Information Management Software JDBC Needs Runtime Java Metadata metadata ƒ To use IMS DB requires java metadata that describes and names the details of the database views (PCBs)  For DB2. 4.0). new DLISegmentInfo(AUTOLPCBORDERSegment.. 10. DLITypeInfo. new DLISegmentInfo(AUTOLPCBSALESSegment.PDS. static DLISegment AUTOLPCBDEALERSegment= new DLISegment ("DealerSegment".dealership. import com.CHAR. new DLISegmentInfo(AUTOLPCBMODELSegment. new DLITypeInfo("DealerName". 10..CHAR. } XMI members 1) PSBs/DBDs If you can read this you do XMI not need glasses. specify: new DLISegmentInfo(AUTOLPCBSALESINFSegment..AUTO SEGM DBDName=AUTODB SegmentName=DEALER GenJavaSource=YES JavaName=DealerSegment OutPath=samples/dealership FIELD Name=DLRNO JavaType=INTEGER Package=samples.61). DLITypeInfo. data types.ibm. public class AUTPSB11DatabaseView extends DLIDatabaseView { // The following DLITypeInfo[] array describes Segment: DEALER in PCB: AUTOLPCB static DLITypeInfo[] AUTOLPCBDEALERArray= { new DLITypeInfo("DealerNo".ims. it is generated by the DLIModel Utility DLIModel IMS Java Report ======================== Class: AUTPSB11DatabaseView in package: samples. 30. "CITY"). 35.1). however this is just silly writting to IMS Java represent the control statements that are the input to the utility. Control statements to // An array of DLISegmentInfo objects follows to describe the view for PCB: AUTOLPCB static DLISegmentInfo[] AUTOLPCBarray = { new DLISegmentInfo(AUTOLPCBDEALERSegment.*.db. new DLITypeInfo("DealerPhone". 2) Copybook members Metadata Class (HFS or PDS) 3) Aliases.*. copybook new DLISegmentInfo(AUTOLPCBSTOCKSegment. import com. PSB DL/I Model DBD (PDS) Utility package samples. new DLISegmentInfo(AUTOLPCBSTOCSALESegment.base.4). DLITypeInfo. COBOL . 7.June 2005 Page 41 IBM Software Group | DB2 Information Management Software DLIModel Input Control Statements //****************************** // Options //****************************** //****************************** // Physical Segment Definitions OPTIONS PSBds=SAMPLE. "DLRNO").DLIDatabaseView. DLITypeInfo.CHAR.June 2005 Page 42 21 . 55."DEALER". . new DLITypeInfo("DealerCity"..ibm.1).

DLITypeInfo. new DLISegmentInfo(AUTOLPCBSALESSegment. 5. DLITypeInfo. new DLISegmentInfo(AUTOLPCBSTOCSALESegment. // PATHOPTS=(OWRONLY..out' //HFSERR DD PATH='/tmp/&SYSUID. The prefix “AUTOLPCB” is .BLKSIZE=137) //STDERRL DD SYSOUT=&SOUT..5) }.ibm.CHAR.. Two types of metadata new DLITypeInfo("DealerCity".COND=EVEN //SYSTSPRT DD SYSOUT=&SOUT //HFSOUT DD PATH='/tmp/&SYSUID.LRECL=133.. 2. the PCB name } metadata IMS and WebSphere .1). Defining & Mapping new DLITypeInfo("DealerPhone".ims. new DLISegmentInfo(AUTOLPCBSTOCKSegment.. "PHONE") java names to IMS }. 10.1). 45.CHAR. static DLISegment AUTOLPCBDEALERSegment= new DLISegment names ("DealerSegment".0).61).OCREAT. Not intended to be read by the import com. DLITypeInfo.. 10. // PATHMODE=SIRWXU //*---------------------------------------------- //* Redirect stdout and stderr output to SYSOUT: //STEP2 EXEC PGM=IKJEFT01 ..DYNAMNBR=300.err' //STDOUTL DD SYSOUT=&SOUT.OCREAT. or from a downloadable Eclipse plug-in //DLIMODEL PROC DSNAME=. 55. Hierarchy for implicit new DLISegmentInfo(AUTOLPCBMODELSegment. "DLRNO").OTRUNC). new DLITypeInfo("DealerZip". // PARM='SH "/usr/lpp/ims/imsjava91/dlimodel/go" "&DSNAME"' //STDENV DD DUMMY //STDOUT DD PATH='/tmp/&SYSUID. 1.4). DLITypeInfo. "CITY"). new DLITypeInfo("DealerName". import com.DCB=(RECFM=VB.. 35.June 2005 Page 44 22 ..OTRUNC).out'.ibm. Note: new DLISegmentInfo(AUTOLPCBSALESINFSegment. IBM Software Group | DB2 Information Management Software Running the DLIModel Utility ƒ You can run this java utility from z/OS UNIX System Services. ƒ Table/segment // An array of DLISegmentInfo objects follows to describe the view for PCB: AUTOLPCB ƒ Column/field static DLISegmentInfo[] AUTOLPCBarray = { new DLISegmentInfo(AUTOLPCBDEALERSegment. 7. .*.DLIDatabaseView. 30.err'.1). // PATHOPTS=(OWRONLY.dealership.SOUT='*' //******************************************************************** //* THIS PROC RUNS THE IMS JAVA UTILITY IN BATCH MODE //******************************************************************** //STEP1 EXEC PGM=BPXBATCH.DCB=(RECFM=VB. 4. the z/OS BPXBATCH utility.db."DEALER". // PATHMODE=SIRWXU //STDERR DD PATH='/tmp/&SYSUID.June 2005 Page 43 IBM Software Group | DB2 Information Management Software DLIModel Generated Metadata ƒ Java Class that has a 1:1 relation with the IMS PSB package samples..AUTOLPCBDEALERArray. 1..*.LRECL=133.BLKSIZE=137) //SYSPRINT DD SYSOUT=&SOUT // PEND metadata IMS and WebSphere .CHAR.ims. "DLRNAME").CHAR.INTEGER.ROOT). DLITypeInfo.base. joining new DLISegmentInfo(AUTOLPCBORDERSegment. "ZIP"). public class AUTPSB11DatabaseView extends DLIDatabaseView { programmer // The following DLITypeInfo[] array describes Segment: DEALER in PCB: AUTOLPCB static DLITypeInfo[] AUTOLPCBDEALERArray= { new DLITypeInfo("DealerNo".

June 2005 Page 45 IBM Software Group | DB2 Information Management Software Programming with JDBC . IBM Software Group | DB2 Information Management Software DLIModel Generated IMS Java Report This is what the programmer uses DLIModel IMS Java Report Name of metadata class to use ======================== Class: AUTPSB11DatabaseView in package: samples..executeUpdate("INSERT .").... defined by Segment: ModelSegment Field: ModelKey Type=CHAR ++ Primary Key Field ++ imported copybook or by Field: Year Type=CHAR (Search Field) control statements with data Field: MSRP Type=PACKEDDECIMAL TypeQualifier=999999.CONCUR_READ_ONLY). ResultSet.June 2005 Page 46 23 ..... integer count = stmt.TYPE_SCROLL_INSENSITIVE. answer....99 (Search Field) type and field type Field: Count Type=INTEGER (Search Field) ================================================== information (sec. either ================================================== DBD defined.) Field: OrderNo Type=CHAR ++ Primary Key Field ++ .. Segment: OrderSegment search fld.. ƒ Specify and execute SQL call ResultSet answer = stmt.. metadata IMS and WebSphere . Segment: DealerSegment segments and fields to use in Field: DealerNo Type=INTEGER ++ Primary Key Field ++ Field: DealerName Type=CHAR (Search Field) SQL (JDBC) calls Field: DealerCity Type=CHAR (Search Field) Field: DealerZip Type=CHAR (Search Field) Field: DealerPhone Type=CHAR (Search Field) Fields within segments.. Note the result of a JDBC SELECT is a “Result Set” (a set of rows) rather than a single segment IMS and WebSphere . Field: Time Type=TIME (Search Field) Hierarchy of segments ================================================== Segment: SalesSegment (level of indention) Field: SaleNo Type=CHAR ++ Primary Key Field ++ . etc.createStatement(ResultSet... ƒ For a SELECT. access individual rows and extract columns ..Overview ƒ Establish connection to DB manager (create Connection object) ƒ Build SQL statement object and define type of result set Statement stmt = con.. Index.executeQuery("SELECT .next() ...")..dealership generated for PSB: AUTPSB11 for establishing connection to this database ================================================== PCB: Dealer ================================================== Names (alias names) of PCB..

WHERE clause on INSERTs ƒ ALL ƒ GROUP BY ƒ SELECT ƒ AND ƒ UPDATE ƒ INTO ƒ AS ƒ INSERT ƒ MAX ƒ ASC ƒ DELETE ƒ MIN ƒ AVG ƒ OR ƒ COUNT ¾ FROM ƒ ORDER BY ƒ DESC ¾ WHERE ƒ SUM ƒ DISTINCT IMS and WebSphere . DataSource dataSource = Required (DataSource)ctx.getConnection(url).getConnection().ibm. which will then generate the connection. Load and Use the IMS-provided JDCB Driver PS Class. Connection con = DriverManager.June 2005 Page 48 24 .forName("com. IMS and WebSphere . Use the DataSource technique to create a “connection factory” for a database PSB.Connecting to the Target Database (IMS PSB) ƒ The JDBC API includes “connecting to the target database”. Implicit joining of tables up IMS hierarchy 2. The DataSource is pre-registered with the Java Naming and Directory Interface (JNDI) Context ctx = new InitialContext(). IBM Software Group | DB2 Information Management Software JDBC .June 2005 Page 47 IBM Software Group | DB2 Information Management Software JDBC – IMS-Supported SQL Functions ƒ IMS Java’s implementation of JDBC supports a selected subset of the full facilities of the JDBC 2.db.AUTPSB11DatabaseView". B String url = "jdbc:dli:samples.ims.lookup("DealershipDB"). in EJBs Connection con = dataSource. or 2.DLIDriver").dealership.1 API  Two unique features are 1. There are two ways of doing this in general - 1.

Employee FROM MyPCB. Dept AS Department FROM MyPCB.June 2005 Page 49 IBM Software Group | DB2 Information Management Software JDBC – SELECT Result Set Types ƒ The output from a JDBC SELECT is a Result Set (= a table) ƒ The characteristics of this result set are determined by an option of the create statement method  Statement stmt = con.?.CONCUR_READ_ONLY) ƒ TYPE_FORWARD_ONLY  Only function allowed after “executeQuery(query)” is “ResultSet.?.Employee ORDER BY lastName ASC.Order WHERE Dealer.next() • ResultSet. createStatement(type. Price.DealerNumber = ’123’ AND Order. CarModel. and  Subsequent Calls: GROUP BY always use TYPE_SCROLL_INSENSITIVE • ResultSet.?. EPAHighwayMileage. EPACityMileage. DeliverDate = ’12/11/2004’ WHERE Order.Order SET SerialNo = ’93234’. INSERT requires WHERE Dealer.absolute(int) query.relative(int) IMS and WebSphere . ORDER BY. CarMake.?. No locks are held • ResultSet. IBM Software Group | DB2 Information Management Software SQL Examples Column in result set is AVG_age SELECT EMPNO AS EmployeeNumber SELECT AVG(age).OrderNumber = ’345’ UPDATE DealershipDB.Employee WHERE EMPNO > 54321 GROUP BY Department SELECT * FROM MyPCB. CarYear. Horsepower) VALUES (?.OrderNumber = ’123’ IMS and WebSphere .DealerNumber=? “WHERE” whenever possible DELETE FROM DealershipDB.Model(ModelTypeCode.next()”  Each “next” call accesses the IMS DB ƒ TYPE_SCROLL_INSENSITIVE  executeQuery hits DB.previous() Data is as it was at time of • ResultSet.?.?. firstName DESC INSERT INTO DealershipDB.?) Use Prepared Statements Statements NB. and caches all results Aggregates.June 2005 Page 50 25 .

availability. scalability and security ƒ But customers also want (need) to move to Service Oriented Architecture and On Demand environments ƒ The old and new worlds have different IT terminology and (usually) different IT personnel  Misunderstanding. fear and lack of communication abound!  But businesses need cooperation and integration ƒ WebSphere is the bridge between the two worlds Provides deployment of IMS transactions and IMS databases in the new paradigms IMS and WebSphere . IBM Software Group | DB2 Information Management Software Summary ƒ Many customers have huge “irreplaceable” investments in IMS DBs and Transactions  IMS still provides unmatched levels of performance.June 2005 Page 51 26 . reliability.