ims database access enhancements - ibm www page · pdf fileims database access enhancements...
TRANSCRIPT
2
APPLICATIONPROGRAM
DL/I DATABASE
TMCommonServices
CALL DATA
DL/I is the IMS Application Program Interface to IMS managed resources
DL/I Environment
DB
3
IMS
DL/I Call Handler
APPLICATION PROGRAM 'ANYPROG'CALL ‘xxxTDLI’
DL/I LANGUAGE INTERFACE (DFSLI000) ‘xxxTDLI'
CALL
DL/I Language Interface
4
Using the AIB Interface
• Most DL/I calls can be issued in two ways:• Using a PCB (standard technique):
• CALL xxxTDLI ( <count>,FUNC,PCB,I/O AREA,... )
• Using an AIB (new technique):• CALL AIBTDLI ( <count>,FUNC,AIB,I/O AREA,... )
• New calls must use the AIB interface:• For example: ICAL
5
I/O AREASEGMENT (S) TO/FROM DATA BASE
PCB/AIB AREARETURN INFO FROM DL/I
PROGRAM-AREA
PROGRAM ENTRY
CALLS TO DL/I (GET
INSERTREPLACEDELETE)
PROCESSINGTERMINATION
DL/I MODULESDL/IAREA
Application Program Structure
6
SEGMENT NAME b
18
SSAs may be used to "qualify" a DB call in two ways :
1. Unqualified SSA to identify only the segment type
Segment Search Arguments (SSAs)
SEGMENT NAME (
18
SEARCHFIELD
RELOPERATOR
)COMPARATIVE
VALUE
28 1-255
2. Qualified SSA identifies specific occurrences of segments
b= or EQ, = or NE
b> or GT, >= or GE
b< or LT, <= or LE
7
PROGRAM
DATA DESCRIPTION
DATABASE
PSB DBD
Data Independence• Separate the program from the physical characteristics of
the databases
• Advantages
• Simplifies application program development• Provides security, integrity, and consistency of a database• Facilitates changes to database
8
ACBGENPROCESS
CONTROLSTATEMENTS
PSBLIB
ACBLIB
DBDLIB
DBD
PSB
DBDPSB
Application Control Blocks
Catalog
PSB
DBD
9
SQL access to IMS Data - IMS Java
• A set of classes which...• Enables SQL access through
the JDBC interface
IMS DB Metadata
Mapping to DL/I APIs
CEETDLI Interface
JNI
Base
App
DB
JDBC / SQL
Customer Code
IMS Java Class Library
C Layer Interface to IMS
Business Logic
JDBC, JCA interface Java to C interface
IMS JavaApp
Catalog
PSB
DBD
10
SQL access to IMS Data - IMS Java
• A set of classes which...• Enables SQL access through
the JDBC interface
IMS DB Metadata
Mapping to DL/I APIs
AIB Interface
Base
App
DB
JDBC / SQL
Customer Code
IMS Java Class Library
Only AIB Interface to IMS
Business Logic
JDBC, JCA interface SQL to AIB interface
IMS JavaApp
Catalog
PSB
DBD
11
FROM SomePCB.Order
ORDER
DEALERMODEL
DEALER
SALESINF
SALESPER
STOCKSALESORDER
MODEL
SQL Parsing in IMS Java Code
SELECT Dealer.Name, Dealer.Phone, Order.LastName
SSA List
SQL
WHERE Model.MSRP > ‘50000’AND Order.Date >= ‘5/1/2009’AND Order.Date <= ’5/31/2009’
DEALER
MODEL
ORDER
Where IMS Java Code executes is where SQL parsing executes
12
SQL Parsing in IMS Java Code
• Requirement - Improve performance for SQL data aggregation• Example
• How much money has my insurance company paid out in claims for the year 2011?
• SELECT SUM(CLAIMAMOUNT) FROM CLAIMS WHERE YEAR=2011
IMS DB
z/OSClient Application
IMSJDBCDriver
Equivalent DLI Call:
GU …/GN …
Claims$2432$41…$6255
+ ________$797439097
Claims$2432$41…$6255
Claims$2432$41…$6255
13
SQL Parsing in IMS • IMS intends to invest in SQL Call Handler• Example with IMS SQL call handler
• How much money has my insurance company paid out in claims for the year 2011?
• SELECT SUM(CLAIMAMOUNT) FROM CLAIMS WHERE YEAR=2011
IMS DB
z/OSClient Application
IMSJDBCDriver
SQL Call
Claims$2432$41…$6255+ ________
$797439097
Claims$2432$41…$6255
IMS SQLCall Handler
$797439097
Total Claims
$797439097
14
RYO
SQL Parsing in IMS
• Open Database End to End flow with native SQL
IMS DB
z/OSIMS
JDBCDriver ODBM
IMSConnect
IMSCatalog
IMSJDBCDriver
IMS Java
enabled
Dep Region
Type 4
Type 2
IMS DB
IMSCatalog
DRDADRDA
SQL
SQL
IMSSQLCall
Handler DLI
15
IMS SQL Support for COBOL • Requirement
• Customers need access to IMS databases using SQL from IMS managed COBOL application programs
• Solution
• IMS intends to invest in COBOL SQL Calls• Convert SQL statements to DL/I database calls
• Handle SQL errors• Benefits
• Reduce application development cost by leveraging existing SQL skills
• Expands IMS database access for application and database developers.
16
IMS SQL Call Handler
IMS SQL Call Handler
DFSLI000
IMS DB
SQLTDLI
DLI
SQLSQLCA
EXEC SQLDLI(CALL SQLTDLI USING SQL-PARMLIST)::
Retrieve IMS database PCB Schema metadata on first SQL call
Parse and validate SQL
Build and make DLI call to access IMS data
Perform aggregation on results data (if needed)
Map results data back to the application
IMS Catalog
Metadata
COBOL Application
SQLCA + Data
IMS MPP,IFP,BMP
1717 IMS 13 T3 Class April 16-18, 2012 | IBM Confidentia l
Customer Requirements
• Customer needs currently not being met• Being able to access IMS data directly from .NET applications just like
any other supported SQL database on the market today
• Tasks customers want to perform but cannot today
• Today, .NET-based IMS customers who need access to IMS data from .NET applications are forced to:• Set up a replication environment where IMS data is copied to a
.NET accessible database server• Implement data proxy solutions that don’t offer direct connectivity• Increase code path by implementing bridge solutions
• All of these alternate paths mean either higher development costs, higher management costs, and/or higher runtime costs
• IMS intends to invest in .NET access to IMS data
18
ODBC .NETData Provider
IDS/DB2 ODBC Driver
Application (ASP.NET)
DB2/IDSDB
Data Provider
DB
IDS DB
OLE DB .NETData Provider
ADO.NET
IDS/DB2 OLE Driver
DB2 Connect .NET Data Provider
ADO.NET Data Provider Architecture
Data ProviderMS SQL
DRDA
19
.NET Data Provider Architecture
.NET Data Provider
SelectCommand
InsertCommand
UpdateCommand
DeleteCommand
DataAdapter
Command
SQL + Parameters
DataReader
DataSet
DataRelationCollection
DataRowCollection
DataColumnCollection
ConstraintCollection
DataTable
Connection
DRDA Client
DataReader object is used for fast-forward reading streams of data
Result Set Data
DataSet a memory-resident relational representation of data
20
.NET Data Provider Requirement
DRDA
IMS
Application Server
ODBMDATASTORE (NAME=IMSA)
ALIAS (NAME=IMS)
z/OS
TCP/IPDDM
IMS Connect
TCPIP
DRDA
PORT
8888
SCI
DRDA
SQLcalls
DRA
CCTL
ODBA
SCIOM
IMS DB
IMS CatalogPSB1
IMS SQL Call Handler
Command
SQL + Parameters
DataReader
Connection
DRDA Client
ADO.NET
Applications
Connection Pool
drdaserver.ims.com
Result set data
DataAdapterDataSet
21
.NET Data Provider Architecture Connect and Disconnect Mode Concepts
• Connected architecture• Every select, insert, update, delete is an access to the
database
• Disconnected architecture• Fetch the data from the database into local DataSet• Manipulate data w/o accessing the database• When complete commit all your changes to the database.
22
.NET Data Provider Architecture Connection Pool
DRDA
IMS
Application Server
ODBMDATASTORE (NAME=IMSA)
ALIAS (NAME=IMS)
z/OS
TCP/IPDDM
IMS Connect
TCPIP
DRDA
PORT
8888
SCI
DRDA
SQLcalls
DRA
CCTL
ODBA
SCIOM
IMS DB
IMS CatalogPSB1
IMS SQL Call Handler
Connection Pool
ADO.NET
Applications
DRDA Port
8888
Host
drdaserver.ims.com
Datastore
IMS
Database
PSB1
UID Me PWD **
drdaserver.ims.com
DRDA Port
8888
Host
drdaserver.ims.com
Datastore
IMS
Database
PSB1
UID bb PWD bb
Pooling true Min Pool Size 0 Max Pool Size 100
OPEN
OPEN
23
Requirement: DataPower to IMS DB
DataPower
IMS
JDBC
Driver
Routing/
data
transformation
SQL
sends /
receives
DRDA
sends /
receives
IMS DB
ODBMIMS
Connect
IMSCatalog
IMS DB
IMSCatalog
DRDA
SQL
IMSSQLCall
HandlerDLI
Back
End
services
2424
SSA Enhancement - Get by Offset
• Solution• IMS 12 APAR PM65139 / PTF UK81837 & UK81838
• New SSA command code “O”
• Enhanced database SSA processing with ability to search for data in a segment by specifying a field position and length instead of a field name
• Contains core IMS database code
• IMS 12 APAR PM69378 / PTF UK81917• Enhanced IMS Universal Drivers to allow SQL predicates
containing ‘columns’ not defined in the DBD by internally converting ‘columns’ to position and length for SSA qualification
• Contains IMS universal driver code
APAR & PTFs CLOSED
APAR & PTF CLOSED
25
SSA with command code, offset and length
1 2 3123456789012345678901235678901234567LAST1 FIRST1 555-1111 1999999 LAST2 FIRST2 555-2222 2999999LAST3 FIRST3 555-3333 3999999
Database
Field Offset LenLASTNAME 1 10
DBD
COBOL CopybookGU TELEBOOK (LASTNAME=LAST2)
GU TELEBOOK*O (00000001 000000010=LAST3)
GU TELEBOOK*O (00000011 000000010=FIRST1)
Field Offset LenLASTNAME 1 10FIRSTNME 11 10 EXTENSIN 21 10ZIPCODE 31 7 Offset Length
2626
SSA Enhancement - New “SD ”Status Code
• Explanation• For call-level programs:
• When command code O is specified with a segment search argument (SSA), the SSA is not allowed to contain position and length values for a segment of a Fast Path secondary index database.
• For command-level programs:• When command code O is specified, the SSA format with position
and length values is not allowed against a segment of a Fast Path secondary index database.
• Programmer response• Correct the SSA
2727
• Performance Considerations
• Performance will be similar to a non-key field search
• IMS will scan the database looking for matches
• Qualification of the root key will reduce impact• If business need requires searching on a non-
key field • consider defining as a searchable field in the DBD
SSA Enhancement - Get by Offset
2828
SSA Enhancement - SQL to DLI translation
• Connection.nativeSQL(String) method will display the DLI equivalent of an SQL query
• SELECT * FROM LARGE2.GBO02 WHERE GBO01.FIRSTNAME='KIN'
GHU HOSPITALGBO01 *O((x'1F',x‘A')EQKIN )GBO02
[LOOP]
GHN HOSPITALGBO01 *O((x'1F',x'A')EQKIN )GBO02
2929
SSA Enhancement - SSAs in the DRDA log
• The Universal driver logs will show the exact SSA that is used in the IMS DLI Call
• SELECT * FROM LARGE2.GBO02 WHERE GBO01.FIRSTNAME='KIN‘
SEND BUFFER: SSALIST (ASCII) (EBCDIC)004ED00300010048 CC060006C9050003 .N.....H........ .+}.........I...
000DC906C8D6E2D7 C9E3C1D3400024C9 ............@.$. ..I.HOSPITAL ..I
06C7C2D6F0F14040 405CD64D0000001F ......@@@\.M.... .GBO01 *O(....0000000AC5D8D2C9 D540404040404040 .........@@@@@@@ ....EQKIN
5D000DC906C7C2D6 F0F240404040 ].........@@@@ )..I.GBO02
Tracing must be enabled for the universal drivers. The DRDA log can be sent to a file, the console or the joblog.
30
DBDGEN Support for Unsigned Data Types
• APAR - PM64418 PTF - UK79443• Problem
• IMS Explorer generates DBD source which includes new unsigned data types and internal type converters which are not supported by DBDGEN
• Large positive signed 2's complement data element values are made negative.
• Solution• FIELD macro add support UBYTE, UINT, ULONG, and
USHORT data type values on the DATATYPE= parameter• DFSMARSH macro add support UBYTE, UINT, ULONG, and
USHORT internal type converter values on the INTERNALTYPECONVERTER= parameter
31
DBDGEN FIELD Statement>>-FIELD >-DATATYPE=+-ARRAY+-BINARY+-BIT
+-BYTE +-UBYTE+-CHAR+-DATE+-DECIMAL(pp,ss)+-DOUBLE+-FLOAT
+-INT +-UINT+-LONG +-ULONG+-OTHER
+-SHORT +-USHORT+-STRUCT+-TIME+-TIMESTAMP+-XML
32
DBDGEN DFSMARSH Statement
>>-DFSMARSH
>--+-,INTERNALTYPECONVERTER=
+-CHAR
+-BIT
+-BINARY
+-BYTE +-UBYTE
+-SHORT +-USHORT
+-INT +-UINT
+-LONG +-ULONG
+-FLOAT +-DOUBLE
+-PACKEDDECIMAL +-ZONEDDECIMAL
+-CLOB +-BLOB +-XML_CLOB +-ARRAY +-STRUCT
33
IMS Universal Drivers Unsigned Type Support • APAR - PM62076 PTF - UK80831• Problem
• NullPointerException in the IMS Universal Drivers when accessing a Secondary Index with a single source field that is defined as packed decimal.
• Solution• The IMS Universal Drivers have added support for the following data types:
• UTINYINT • USMALLINT • UINTEGER • UBIGINT
• Benefits• Users are now able to access a Secondary Index with a single source field
of any type • Users will no longer receive an UnsupportedTypeConversion message
when accessing a variable length segment where the length field (LL) is defined as BINARY.
34
COBOL formats mapped to DLITypeInfoconstants
• PIC X(25) CHAR• PIC 9(02) COMP UTINYINT• PIC S9(04) COMP SMALLINT• PIC 9(04) COMP USMALLINT• PIC S9(06) COMP-4 INTEGER• PIC 9(06) COMP-4 UINTEGER• PIC 9(06)V99 COMP or COMP-4 BINARY• PIC S9(12) BINARY BIGINT• PIC 9(12) BINARY UBIGINT• COMP-1 FLOAT• COMP-2 DOUBLE• PIC S9(06)V99 ZONEDDECIMAL• PIC 9(06).99 ZONEDDECIMAL• PIC S9(06)V99 COMP-3 PACKEDDECIMAL
35
Summary
• IMS DB Access • IMS continues to invest in open access to IMS
databases• IMS continues to evolve