TopTop 1010 ReasonsReasons toto UpgradeUpgrade DBDB22 99 forfor z/OSz/OS Now!Now!

Today’s Webinar Agenda

Ì Manager’s Top Reasons – Steve Paravola (SoftBase)

Ì DBA’s Top Reasons – Troy Coleman (SoftBase)

Ì Developer’s Top Reasons – Troy Coleman (SoftBase)

Ì DB2 9 for z/OS Q & A – Roger Miller (IBM)

-1- TopTop 1010 ReasonsReasons toto UpgradeUpgrade DBDB22 99 forfor z/OSz/OS Now!Now!

Ì Managers 1) Plug and Play CPU Cycle and DASD Savings 2) PureXML – Include DB2 for z/OS in your SOA Applications 3) DB2 9 can Participate in Cross-Company Applications Ì Database Administrators (DBAs) 4) Improved Availability, Scalability and Performance 5) Improved Security and Regulatory Compliance 6) ERP Applications and Data Warehouse Enhancements Ì Application Developers 7) pureXML and SOA Architecture provide great XML Data Access 8) Many SQL Enhancements including Spatial Data Support 9) Improved Programming Interface with Improved Debugging Ì Everyone! 10) Sooner Upgrade Party, Faster Promotion, Summer Weekends Free!

-2- ReasonReason #1#1 (Managers):(Managers): PlugPlug && PlayPlay CPUCPU SavingsSavings

DB2 9 For z/OS Provides Many Immediate Performance Improvements Ì Significant CPU time reduction in most utilities Ì Synergy with new hardware: zIIP, MUDAW, DS8000, and more Ì Performance / Scalability enhancements, especially INSERT, UPDATE, and DELETE performance Ì Query / Access Path performance enhancements Ì Improved virtual storage usage below 2GB DBM1 Ì Other performance enhancements - Native SQL Procedure, Index Compression - LOBs, Varchars -3- ReasonReason #1#1 (Managers):(Managers): PlugPlug && PlayPlay CPUCPU SavingsSavings

Utility CPU Time Reductions (Primarily from Index Processing*)

Ì 10 to 20% in Image Copy, Recover index* Ì 5 to 30% in Load*, Reorg*, Rebuild Index* Ì 20 to 60% in Check Index* Ì 35% in Load Partition* Ì 30 to 40% in Runstats Index* Ì 40 to 50% in Reorg Index* Ì Up to 70% in Load Replace Partition with dummy input*

Copyright IBM Corp. 2007 Author Roger Miller

-4- ReasonReason #1#1 (Managers):(Managers): PlugPlug && PlayPlay CPUCPU SavingsSavings

Utility CPU Time Reductions (Primarily from Index Processing*)

Ì IBM has seen substantial performance improvements in DB2 9 utilities, with some early customers noting as much as 20% to 30% overall reductions in utility CPU time Ì If utilities are 30% of the total CPU time, and you average 20% improvements, then the net would be a 6% reduction in total DB2 CPU Ì Primary improvements are in index processing as noted above, so if you will probably have more improvements if you have more indexes Ì Results and mileage may vary – as Roger Miller always says, “It Depends!”

Copyright IBM Corp. 2007 Author Roger Miller

-5- ReasonReason #1#1 (Managers):(Managers): PlugPlug && PlayPlay CPUCPU SavingsSavings

Other DB2 9 for z/OS Savings & Cost Benefits

Ì DASD savings Ì Improved database availability – fewer costly production outages Ì Reduced cost of database administration Ì Reduced cost of DB2 application development Ì Improved performance and enhancements for ERP, CRM, and other third party applications

Ì Faster DB2 9 for z/OS SOA/XML application development times

-6- ReasonReason #1#1 (Managers):(Managers): PlugPlug && PlayPlay CPUCPU SavingsSavings

Some Early Release Customer Savings & Results:

Ì Measurement tests on Rebuild Index and Index Compression show up to 50% space savings at large customers; Reorg Utility elapsed times improved 33% - 147% in some beta tests

Ì CPU improvement for one specific query in global optimization testing was from 8.96 minutes to .99 seconds

Ì Nightly outage for 1 DB2 SAP production table was cut from 15-30 minutes using LOAD REPLACE to under 1 minute using cloned tables

Ì Early DB2 9 for z/OS test customers included insurance, manufacturing, finance, energy, government, and other organizations

-7- ReasonReason #2#2 (Managers):(Managers): PureXMLPureXML -- DBDB2929forfor z/OSz/OS

Integrate DB2 9 For z/OS Into Your SOA Initiatives

DB2 for z/OS SOA/XML Application Inclusion

-8- ReasonReason #2#2 (Managers):(Managers): PureXMLPureXML

Service Oriented Architecture (SOA) Overview

-9- ReasonReason #2#2 (Managers):(Managers): PureXMLPureXML

Service Oriented Architecture (SOA) Overview XML

DB2 9 XML XML

for z/OS XML pureXML

-10- ReasonReason #2#2 (Managers):(Managers): PureXML-PureXML- DBDB2929forfor z/OSz/OS

DB2 9 For z/OS Into Your SOA Support (APIs)

Ì JAVA (JDBC, SJLJ), ODBC

Ì C/C++, COBOL, PL/I, Fortran, Assembly

Ì .NET

-11- ReasonReason #2#2 (Managers):(Managers): PureXMLPureXML -- DBDB2929forfor z/OSz/OS pureXML Overview

Ì “This is not a bolt-on or band-aid approach, DB2 9 for z/OS is XML without compromise!” -- Kevin Campbell, Application Architect Univar USA Ì SQL/XML is the best of both worlds – DB2 is a world-class hybrid database! Ì Full power of XQuery and XPath 2.0 to address and transform XML documents Ì Join XML documents and tables Ì Use both SQL and XML predicates Ì Create XML from structured fields Ì Material tables from XML documents

-12- ReasonReason #3#3 (Managers):(Managers): PureXMLPureXML -- DBDB2929forfor z/OSz/OS

Include Your Organization into Key Cross-Corporate Applications

Ì “Approximately 90% of the valuable data in contractual agreements are unstructured … XML technology … is essential in tapping into this hidden reservoir of information, enabling companies to actively manage and maximize customer, supplier and partner relationships.!” -- Nextance Press Statement 11/05 Ì “XML database revenue is growing at twice the rate of the total database market” -- IDC Research Group

Ì “When will your solutions support application testing for DB2 9 for z/OS? We will be deploying it as soon as humanly possible!” -- SoftBase Customers IOD 2006 - IDUG 2007

-13- ReasonReason #3#3 (Managers):(Managers): PureXMLPureXML -- DB2DB2 99 forfor z/OSz/OS

Include Your Organization into Key Cross-Corporate Applications Emergency Room Insurance/ Pain Killing Payment Drugs

Follow Up Surgeon Healthcare Hospital Operates Admits Patient

-14- ReasonReason #3#3 (Managers):(Managers): PureXMLPureXML -- DBDB2929forfor z/OSz/OS

Include Your Organization into Key Cross-Corporate Applications

Ì Insurance, Healthcare, Manufacturing, Financial industries have already adopted XML standards and are moving forward Ì Your company and organization will have to build new DB2 9 for z/OS applications to communicate with business customers and suppliers Ì DB2 9 for z/OS enables you to compete within the new emerging Business-to-Business (B2B) marketplaces Ì DB2 9 for z/OS pureXML enables key XML data to be stored with other production data and to be protected by a world-class data server! -15- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

Reordered Row Format

Ì Automatically reorder of columns in the row with all Variable Length (VL) columns moved to the end

Ì Stores the offset of all VL column together at the beginning of the VL columns

Ì Reduced logging reduces CPU and DASD

Ì Major CPU reduction with direct access to VL columns especially when you have many VL columns.

Ì Requires REORG for pre-V9 table spaces -16- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

Enhanced Sequential Key Inserts Root Page V8 A2 D4 Root Page A6 B3 C2

INSERT A4 D4 A1 A3 B1 A5, A6, A7 B3 C2 A2 A4 B2 Wasted A5 B3 Wasted A6 Split using 50/50 Algorithm Root Page A1 B1 V9 A2 D4 A2 B2 A6 B3 C2 A3 B3 A1 A5 B1 A4 A2 A6 B2 A3 B3 A4 Split Asymmetrically -17- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

General CPU Reduction Chart

From IBM: DB2 9 for z/OS Technical Overview

-18- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

FlashCopy

Ì The issue with doing a DB2 system level backups is coordinating pausing the logging activity, backing up the system catalog, directory and user objects to a given point in time

Ì DB2 V8 introduced FlashCopy for volume level backup/restore.

Ì DB2 V9 introduces enhanced FlashCopy - Backup to TAPE - DB2 Object level restore - Recovery Utility can restore from FlashCopy datasets

-19- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

Utility: REORG

Ì The issue is having a potential lockout when using online reorgs due to the length of time it takes to build NPI indexes in the build2 phase

Ì DB2 V9 Removed REBUILD2 phase from online REORG

Ì Reorg Elapse Time Reduction (unload/reload) in parallel

Ì V8 limit of reorg on 254 compressed partitions is gone

Ì Improved REORG LOB data with SHARELEVEL REFERENCE

-20- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

Utility: LOAD & UNLOAD

LOAD: Ì Improvements in handling restart loading LOB data - LOAD REPLACE SHARELEVEL NONE then RESTART(PHASE) - SORTKEYS(NO) then RESTART(PHASE) or (CURRENT) Ì LOAD support of DECFLOAT data type Ì CPU reduction in LOAD build index phase

UNLOAD: Ì During UNLOAD with SHRLEVEL CHANGE ISOLATION CS, an additional option of SKIP LOCKED DATA is available

-21- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

Utility: RUNSTATS

Ì Column Frequency VS Histogram Statistics

Ì SELECT * FROM SALES WHERE SALE_DATE BETWEEN ’2007-01-01’ and ‘2007-01-15’; Ì V9 introduced histogram statistics to improve access paths for range predicates

Ì Collection in Quantiles – default is 100

-22- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

Utility: COPY

Ì CHECKPAGE is usually recommended for best practices. However, in V8 the overhead was high with 14% on table spaces and 5% on Index Spaces

Ì DB2 V9 CHECKPAGE is negligible.

Ì CPU reduced due to changes in buffering from Least Recently Used (LRU) to Most Recently Used (MRU)

Ì COPY only copy pending objects using the SCOPE PENDING option.

-23- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

What CPU usage to expect on upgrade

From IBM: DB2 9 for z/OS Technical Overview

-24- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

BIND: REOPT AUTO

Ì REOPT(ALWAYS) – Rebuild the access path on every execution for both static and dynamic statements

Ì DB2 V8: REOPT(ONCE) – Applies to dynamic statements; Rebuild the access path once on first execution using the value in the host variable

Ì DB2 V9: REOPT(AUTO) - Applies to dynamic statements that can be cached. DB2 will determine if the access path needs to be rebuilt.

-25- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

Global Query Optimization

Ì SELECT * FROM DSN8910.EMP X WHERE JOB = ’DESIGNER’ AND EXISTS (SELECT 1 FROM DSN8910.PROJ P WHERE P.DEPTNO = X.WORKDEPT AND P.MAJPROJ = ’MA2100’);

Ì DB2 V8: Rewrites SUBQUERIES to JOIN if possible

DB2 V9 Enhancements: Ì Rewrites the query to be correlated or non-correlated Ì Virtual Tables – DB2 represents a subquery that can’t be transformed into a join. Ì “Early Out” processing; Avoids return of duplicate row without the incurring the cost of sort

-26- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

Resource Limit Facility (RLF) Ì Are you having problems controlling the resources being used by some end user tools doing add hoc reporting? Ì Filter on End-User = IP Address -User-Id - Application Name - Workstation Name Ì API’s for CLI “DB2 Version 9 for , , Windows; Administration API Reference”, SC10-4231 Ì API’s for JDBC: “DB2 Version 9.1 for z/OS Application Programming Guide and Reference for Java”, SC18-9842 -27- ReasonReason #4#4 (DBA):(DBA): AvailabilitAvailability,y, Scalability,Scalability, PerformancePerformance

Universal Tablespace (UTS)

Ì Partition By Growth Segmented Tablespace that can grow Auto Allocate a new partition when full Limit size based on DSSIZE and MAXPARTITIONS Acts like Non-Partitioned but can grow Can only build NPI indexes

Ì Partition By Range Are like Partitioned Tablespaces but segmented One table per tablespace Can create partitioning indexes

-28- 1.8 z/OS User:Smith Role: DBA V9 DB2

21 7. 16

SH 0. S 0 .1 64

-29-

M

D

A

9 0

1

8 S

. 2 .

0 7 Y

6

6 . S

1 2

. 4 .

3 9

H 3 2 S 1 2 . S

4

6 Trusted Context and Roles Reason #5 (DBA): Security & Regulatory Compliance Reason #5 (DBA): Security & Regulatory Compliance Role: DBA User:Smith ReasonReason #5#5 (DBA):(DBA): SecuritySecurity && RegulatoryRegulatory ComplianceCompliance

Benefits of ROLES Ì Do you have problems with DBA’s sharing a SYSADM userid to get their work done? Ì Role can simplify administration of privileges Ì End user’s authid can be used to run database transactions, so that the DB2 audit is able to identify the end users individually (important capability for meeting some regulatory compliance requirements). Ì The Trusted Context retains many of the performance benefits of connection pooling. Ì The Trusted Context and role support can be used to implement DBA privileges that can easily be disconnected and reconnected to individual employees.

-30- ReasonReason #5#5 (DBA):(DBA): SecuritySecurity && RegulatoryRegulatory ComplianceCompliance

Secured Socket Layer (SSL)

Ì DB2 Version 9.1 for z/OS supports the Secure Socket Layer (SSL) protocol by implementing the z/OS Communications Server IP Application Transparent Transport Layer Security (AT-TLS) function

Ì DB2 V9 makes use of SSL encryption using a new secure port

Ì When acting as a requester, a DB2 for z/OS can request a connection using the secure port of the other subsystem

Ì When acting as a server within a trusted context, SSL could be required for the connection

-31- 1.8 z/OS

csmith

CathyS EIM Domain LDAP TDBM DB2 V9 RACF(SAF)

H

S

S -32-

9 8 . 7 6 1 .

3 H 3 S 2 S . 4 6 IBM Websphere 6.1 IBM DB2 Drivers for JDBC/SQLJ IBM DB2 Drivers for ODBC/CLI Enterprise Identity Mapping (EIM) Reason #5 (DBA): Security & Regulatory Compliance Reason #5 (DBA): Security & Regulatory Compliance ¾ ¾ ¾ User: Cathy Smith Password: ****** ReasonReason #5#5 (DBA):(DBA): SecuritySecurity && RegulatoryRegulatory ComplianceCompliance

Audit Management Expert

Ì Designed for Auditors Ì GUI interface requiring no DB2 expertise Ì Gather and correlate a coherent of DB2 activity Ì No DB2 access required Ì Collects LOGS and Trace data into an audit repository Ì Define filter policies for collecting data on a combination of user, object, application connection and time Ì Generate reports on SELECT, UPDATE, DELETE, INSERT activity and many more

Ì More information on IBM Tools at: http://www.ibm.com/software/data/db2imstools/

-33- ReasonReason #6#6 (DBA):(DBA): ERPERP && DataData WarehouseWarehouse EnhancementsEnhancements

Pair-Wise Join

Ì Star-Joins: The problem is storage contention with the GLOBAL storage pool causing in-memory data cache fallback to sparse index access.

Ì Generalize Sparse Index and in-memory data cache Local Pool above the BAR Associate memory to each thread

Ì Dynamic Index ANDing for star join queries using Pair- Wise Join

-34- ReasonReason #6#6 (DBA):(DBA): ERPERP && DataData WarehouseWarehouse EnhancementsEnhancements

Index Compression

Ì Must be 8, 16 or 32K page size Ì No Compression Dictionary Ì Utility DSN1COMP to calculate savings Ì CREATE/ALTER INDEX COMPRESS YES EVALUATION OF COMPRESSION WITH DIFFERENT INDEX PAGE SIZES:

------8 K Page Buffer Size yields a 51 % Reduction in Index Leaf Page Space The Resulting Index would have approximately 49 % of the original index's Leaf Page Space No Bufferpool Space would be unused ------

-35- ReasonReason #6#6 (DBA):(DBA): ERPERP && DataData WarehouseWarehouse EnhancementsEnhancements

LOB Data

Ì Progressive Streaming - Network Flow Optimization

Ì LOB Lock avoidance for SELECT and DELETE

Ì Short locks on INSERT and UPDATE

Ì Availability improves because locks are not held until commit.

-36- ReasonReason #7#7 (Developers):(Developers): pureXMLpureXML andand SOASOA

XML-Enabled Databases V8 XML CLOB/Varchar Shredding DOCXML DOCXML Extract Fixed DOC Selected Mapping elements/attr XML Side Tables XML Shredder DOCXML Patient DOC DOC

docid2

Doctor Claim PK claim_id docid2 docid2

Doctor Insurance Provider Insurance Provider PK Doctor_id PK provider_id FK1 claim_id FK1 claim_id docid2 Varchar / clob No XML Document Regular tables for faster lookup column -37- ReasonReason #7#7 (Developers):(Developers): pureXMLpureXML andand SOASOA pureXML Architecture

-38- ReasonReason #7#7 (Developers):(Developers): pureXMLpureXML andand SOASOA

XML Column and Index create unique index claim_id_ix on CLAIM(invoice) GENERATE KEY USING XML PATTERN ‘/claim/@claimid’ AS SQL CHAR(5) rowid claimid Claim Table 12 10233 Row Invoice ...... id ...... 12 claim_id_ix Dr. Mike Snow select invoice from claim where Mrs. Martha Jones xmlexists(‘$x/claim[claimid=‘10233’]’ 555-456-1212 passing by ref invoice as “x”) 2007-01-12 Bandage cut hand/service> ...... -39- ReasonReason #7#7 (Developers):(Developers): pureXMLpureXML andand SOASOA pureXML Storage

Ì XML data is stored in an “XML” data type column create table claim(claimID char(5),…,claimDOC ); claimID … claimDOC Ì XML is stored in a 10233 … Dr. Mike Snow …. parsed hierarchical format … … …

Ì Relational columns are stored in DB2 Storage relational format

-40- ReasonReason #7#7 (Developers):(Developers): pureXMLpureXML andand SOASOA

Compare XML VS Relational Model

XML Relational

Hierarchical Flat Structure Define parent table to child table Define RelationshipsDocument contains informationrelationships. about the relationship of data items to each other in the form of the hierarchy.Column Defined: The contents of Define Data ContentsSelf-describing; Documentthe contains data is described by the not only the datat also bu tags thatcolum n definition. All data in the column must have the same data explain what the data is. Documenttype. may contain different dataOrder types. of data is not guaranteed Order of Data Inherent; The order of the unlessdata within you specify an ORDER BY the document. No other wayclause to on one or more columns. specify order

-41- ReasonReason #7#7 (Developers):(Developers): pureXMLpureXML andand SOASOA

SQL/XML Publishing

Ì DB2 V8 introduced SQL/XML publishing functions: ƒ XMLAGG – returns a concatenation of XML elements from a collection of elements ƒ XMLATTRIBUTES – Build an XML attribute ƒ XMLCONCAT -- Forest of elements generated from a concatenation of 2 or more elements ƒ XMLELEMENT -- Returns a single XML element ƒ XMLFOREST -- Returns a group of XML elements ƒ XMLNAMESPACE -- Ì DB2 V9 introduced these new publishing functions: ƒ XMLCOMMENT -- Build comment node ƒ XMLDOCUMENT – Build a single document node with zero or more child nodes ƒ XMLPI -- Build a processing instruction ƒ XMLTEXT -- Returns an XML value as a single text node with the value as a string -42- ReasonReason #7#7 (Developers):(Developers): pureXMLpureXML andand SOASOA

SQL/XML for native XML data

Ì You can process native XML data using these functions: ƒ XMLSERIALIZE – Convert XML document to textual XML.

ƒ XMLPARSE – Parse a given argument such as a string expression and insert into an XML column.

ƒ XMLQUERY – a scalar function that queries and extracts data from XML using Xpath expressions.

ƒ XMLEXIST – Used to filter the XML rows returned.

Ì XML2CLOB is gone

-43- ReasonReason #7#7 (Developers):(Developers): pureXMLpureXML andand SOASOA

XMLEXIST

Ì Return Customer ID and Customer Information XML for customer 1004 with the city of Toronto.

SELECT cid, info FROM CUSTOMER WHERE XMLEXISTS (’declare default element namespace "http://posample.org"; //addr[city="Toronto"]’ passing INFO) AND XMLEXISTS (’declare default element namespace "http://posample.org"; /customerinfo[@Cid="1004"]’ passing INFO)

-44- ReasonReason #7#7 (Developers):(Developers): pureXMLpureXML andand SOASOA

SQL/XML Publishing Interface

select xmlserialize( xmlelement( NAME "employeeInfo", xmlnamespaces( DEFAULT 'http://posample.org' ), xmlattributes( E.EMPNO as "EMPNO"), e.lastname ) as clob(100)) FROM DSN8910.emp e #

HAAS LUCCHESI

-45- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Merge

Ì Insert or Update a table/view in one statement

Ì Process an ARRAY of data for Multi-Row update, inserts

Ì Avoids multiple passes and reduces the complexity and code maintenance INSERT into table WHEN SQLCODE = -803 UPDATE the table.

-46- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Select from Update/Delete/Merge Ì DB2 V8 introduced SELECT FROM INSERT Ì DB2 V9 provides SELECT FROM UPDATE,DELETE, or MERGE Ì Data-Change-Table-Reference: Specifies an intermediate result table. This table is based on the rows that are directly changed by the SQL data change statement that is included in the clause.

FINAL TABLE (INSERT statement) FINAL [OLD] TABLE (Searched UPDATE Statement) OLD TABLE (searched DELETE) FINAL TABLE (MERGE statement)

-47- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Select from Merge

SELECT EMPID, SSN, COMMENT, STATUS FROM FINAL TABLE (MERGE INTO CSBP.EMP AS E INCLUDE (STATUS CHAR(3)) USING ( VALUES ('00000003','323124455','4TH COMMENT ') FOR 3 ROWS) AS IT (EMPID, SSN, COMMENT) ON (E.EMPID = IT.EMPID) WHEN MATCHED THEN UPDATE SET COMMENT = IT.COMMENT ,STATUS = ‘UPD’ WHEN NOT MATCHED THEN INSERT (EMPID, SSN, COMMENT,STATUS) VALUES ( IT.EMPID,IT.SSN,IT.COMMENT,’INS’ ) NOT ATOMIC CONTINUE ON SQLEXCEPTION QUERYNO 12 ) ORDER BY SSN#

-48- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Truncate

Additional Parms Ì IMMEDIATE - No Rollback Ì RESTRICT WHEN DELETE TRIGGERS – Stop if you have triggers Ì REUSE STORAGE – Keeps space allocated to table

Default Parms

TRUNCATE TABLE CSBP.EMP DROP STORAGE IGNORE DELETE TRIGGERS

-49- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Intersect and Except

Ì UNION – Return all rows from T1 and T2 (T1+T2) Ì EXCEPT – Return rows from T1 not found in T2 (T1- I) Ì INTERSECT – Return only rows found in T1 and T2 (I)

T1 T2 I

-50- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Except example Ì If the employee works on every project located in Houston, then list the employee's social security number and name.

V8 using NOT EXIST V9 using EXCEPT SELECT E.SSN, E.NAME FROM EMPLOYEE E SELECT E.SSN, E.NAME FROM EMPLOYEE E INNER JOIN WHERE NOT EXISTS (SELECT W1.eSSN FROM WORKSON W1 ( (SELECT P1.PNUMBER WHERE NOT EXISTS FROM PROJECT P1 (SELECT * FROM PROJECT P1 WHERE P1.PLOCATION = 'Houston') WHERE P1.PLOCATION = 'Houston' EXCEPT AND NOT EXISTS (SELECT W.PNUMBER (SELECT * FROM WORKSON W2 FROM WORKSON W WHERE (W1.eSSN = W2.eSSN) WHERE E.SSN = W.SSN)); AND (W2.pno = P1.PNUMBER) ) ) GROUP BY W1.eSSN) AS TMP ON E.SSN = TMP.essn -51- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Instead of Triggers Ì Defined on a VIEW not a table Ì Insert, Update, and Delete on READ ONLY VIEW Ì Provide common view to read and write with enforced business logic create table emp (name char(30), salary decimal(10,2); create emp_euro_vw (name, salary) as select name, salary * 1.25 from emp create trigger emp_insert instead of on emp referencing new as nemp for each row mode db2sql insert into emp values (nemp.name, nemp.salary * .80) insert into emp_euro_vw values (‘George W. Bush’, 1233.40) -52- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

SQL Built-in Functions

Ì ASCI_CHR

Ì EXTRACT date/time Ì MONTHS_BETWEEN Ì TIMESTAMPDIFF Ì TIMESTAMP_FORMAT Ì TIMESTAMP_ISO Ì VARCHAR_FORMAT

Ì SOUNDEX Ì DIFFERENCE

-53- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Months_Between

Ì MONTHS_BETWEEN (expression-1, expression2)

SELECT MONTHS_BETWEEN (CURRENT DATE,'1933-08-14') AS AGE_IN_MONTHS FROM SYSIBM.SYSDUMMY1# ------+------+------+------+------+------+------+ AGE_IN_MONTHS ------+------+------+------+------+------+------+ 885.935483870967742

-54- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Timestampdiff Ì TIMESTAMPDIFF ( numeric-expression, string-expression) Give me the number of months between today and invoiced date 2006-12-04

SELECT TIMESTAMPDIFF (64 , CAST(CURRENT TIMESTAMP – TIMESTAMP(‘2006-12-04-01.01.01.000000') AS CHAR(22))) AS AGE_IN_MONTHS FROM SYSIBM.SYSDUMMY1 Result is 6 Months

-55- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Data Type: BIGINT

Ì BIGINT is 8 bytes for integer storage, supports 63-bit integers

Ì Provides better performance for Java, C, C++

Ì Part of the SQL standards

Ì Minimizes data type conversion cost and facilitates portability.

-56- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Data Type: BINARY and VARBINARY

Ì BINARY is a fixed binary string (1 to 255 bytes)

Ì VARBINARY a variable length string (1 to 32704 bytes)

Ì Improvements in binary data over the character string FOR BIT DATA

Ì Can use CAST function to convert FOR BIT DATA string

-57- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Data Type: DECFLOAT(16) (34)

Ì Native Decimal Floating Point (DECFLOAT) Ì Range is 16 or 34 digits of precision Ì Exponent range is 10-383 to 10+384

Ì INFINITY – a number whose magnitude is infinitely large Ì Quiet NaN – a value that represents undefined results that will NOT cause an invalid number condition Ì Signaling NaN – a value that represents undefined results that WILL cause an invalid number condition Ì Order of compare: -NAN < -SNAN < -INFINITY < 0 < INFINITY < SNAN < NAN More info at: http://www2.hursley.ibm.com/decimal/decifaq4.html

-58- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Data Type: XML

Ì Any column of XML data type can hold one well-formed XML document for every row in the table.

Ì Effective limit of XML document is 2GB

Ì This is NOT A CLOB, the column is stored in a UTS partitioned by growth or UTS partitioned by range depending on the base table space.

Do NOT have to convert to CLOB: XML2CLOB

-59- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Create Table and XML Index DDL

Ì The following DDL will create an employee table with an employee id and resume. The resume will be indexed on college degree. create table employee (empid char(06), resume XML) in dbname.tsname; create index emp_degree_xmlix on employee(resume) GENERATE KEY USING XMLPATTERN '/resume/college/degree' as sql varchar(50) using stogroup sg1;

-60- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Report: List Tables with XML Columns

SELECT SUBSTR(T.DBNAME,1,8) AS DBNAME , SUBSTR(T.TSNAME,1,8) AS TSNAME , SUBSTR(T.CREATOR,1,8) AS CREATOR , SUBSTR(T.NAME,1,18) AS TBNAME , SUBSTR(XRELS.COLNAME,1,18) AS COLNAME , SUBSTR(XRELS.XMLTBNAME,1,18) AS XTBNAME , SUBSTR(XT.TSNAME,1,8) AS XTSNAME FROM SYSIBM.SYSTABLES T , SYSIBM.SYSTABLESPACE TS , SYSIBM.SYSXMLRELS XRELS , SYSIBM.SYSTABLES XT WHERE TS.CREATOR = T.CREATOR AND TS.NAME = T.TSNAME AND TS.DBNAME = T.DBNAME AND XRELS.TBOWNER = T.CREATOR AND XRELS.TBNAME = T.NAME AND XRELS.XMLTBOWNER = XT.CREATOR AND XRELS.XMLTBNAME = XT.NAME ORDER BY T.DBNAME, T.TSNAME, T.NAME WITH UR# -61- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

List Tables with XML Columns Output

Normal Table Information DBNAME TSNAME CREATOR TBNAME ------+------+------+------+- CSBPDB CSBPTS01 CSBP PRODUCT DSN00004 MYCUSTOM CSBP MYCUSTOMER

XML Table Information COLNAME XTBNAME XTSNAME ------+------+------+------+------DESCRIPTION XPRODUCT XPRO0000 INFO XMYCUSTOMER XMYC0000

-62- ReasonReason #8#8 (APP):(APP): SQLSQL && SpatialSpatial DataData EnhancementsEnhancements

Spatial Data

Ì DB2 Accessories Suite for z/OS, V1.1 (5655-R14) Ì Set of Spatial Data Type Ì Spatial User Defined Functions Ì Spatial Stored Procedures Ì Answer questions based on geographic relationships Ì Contains, Crosses, Equals, Intersects, Overlaps, Touches, Within, Distance, and Envelope Intersect in a WHERE clause of a SELECT statement Ì Spatial Indexes to improve performance

-63- ReasonReason #9#9 (Developer):(Developer): ProgramProgram InterfaceInterface && DebugDebug

Developers Workbench

Ì Create, View, Edit DB2 objects Ì Explore and Edit data in tables Ì Visually build SQL and XQUERY statements Ì Develop and deploy stored procedures, UDF, scripts Ì DEBUG Java and Stored Procedures Ì Develop SQLJ applications Ì Develop queries and routines for XML data Ì Perform data movement (load, unload) Ì Collaborate and share projects

-64- ReasonReason #9#9 (Developer):(Developer): ProgramProgram InterfaceInterface && DebugDebug

Developers Workbench V9

Ì Deeper integration with .NET Ì Rich support for XML and SOA environments Ì New drivers and adapters for PHP and Ruby on Rails Ì New application samples

™Developers Workbench is the best thing since sliced bread!!

Download: http://www.ibm.com/software/data/db2/ad/dwb.html

-65- ReasonReason #9#9 (Developer):(Developer): ProgramProgram InterfaceInterface && DebugDebug

XML Query Project SQL/XML

Result Database XML Connection Document

Elements

-66- ReasonReason #9#9 (Developer):(Developer): ProgramProgram InterfaceInterface && DebugDebug

Native SQL Procedures

Ì Eliminates generated C code and compilation Ì Fully integrated into the DB2 engine Any SQL procedure created without the FENCED or EXTERNAL keywords are native SQL procedures Ì zIPP enabled for DRDA clients Ì ALLOW DEBUG MODE, DISALLOW, DISABLE Ì Extensive support for versioning: VERSION keyword on CREATE PROCEDURE CURRENT ROUTINE VERSION special register ALTER ADD VERSION ALTER REPLACE VERSION ALTER ACTIVATE VERSION Ì BIND PACKAGE with new DEPLOY keyword

-67- ReasonReason #9#9 (Developer):(Developer): ProgramProgram InterfaceInterface && DebugDebug

SQL Stored Procedure Project

Parms: WLM, LANG, …

SQL Query

Stored Proc: Results

z/OS Connection

-68- ReasonReason #10#10 (Everyone):(Everyone): BecauseBecause It’sIt’s ReallyReally Cool!Cool!

Deploy DB2 9 for z/OS Because You Should!

Ì Sooner Upgrade Completion Party

Ì Promotions For Everyone

Ì Free Summer Weekends

Ì Because it should be relatively easy compared with DB2 V8 for z/OS!

-69- TopTop 1010 ReasonsReasons toto UpgradeUpgrade DB2DB2 99 forfor z/OSz/OS Now!Now!

Questions & Answers with Roger Miller

-70- TopTop 1010 ReasonsReasons toto UpgradeUpgrade DB2DB2 99 forfor z/OSz/OS Now!Now!

Thank You!

-71-