how is ibm investing in db2 for i - tug.ca new... · for system_time as of current timestamp –2...

36
5/28/2018 1 What’s New in Db2 for i 7.3+ Doug Mack Db2 for i Analytics Consultant IBM Systems Lab Services © 2016 IBM Corporation Welcome to the Waitless World Db2 for i Standard compliant Secure Scalable Functionally Advanced Excellent Performance Easier to use Easier to maintain IBM i 7.1 XML Support Encryption enhancements (FIELDPROCs) Result set support in embedded SQL CURRENTLY COMMITTED MERGE Global variables Array support in procedures Three-part names and aliases SQE Logical file support EVI enhancements Inline functions CREATE OR REPLACE DECLARE GLOBAL TEMPORARY TABLE Catalog views IBM i 7.2 Row and Column Access Control XMLTABLE CONNECT BY OLAP Extensions TRANSFER OWNERSHIP Named arguments and defaults for parameters Obfuscation of SQL routines Array support in UDFs Timestamp precision Multiple-action Triggers Built-in Global Variables 1.7 Terabyte Indexes Navigator Graphing and Charting System Limits for IFS IBM i 7.3 Temporal Generated columns for auditing OLAP Extensions Regression Functions / Covariance EVI Only Access More Built-in Global Variables More SQL Scalar functions More IBM i Services CREATE OR REPLACE TABLE ATTACH & DETACH PARTITION DBE tooling and automation High priority customer requests Value Proposition TR SQL Enhancement TR5/TR1 JSON_TABLE() TR7/TR3 JSON Publish ON GOING ACS Enhancements ONGOING IBM i and Db2 Services ONGOING Many Other SQL Enahancements How is IBM investing in Db2 for i Increase the life expectancy and extend the value of legacy applications

Upload: dodung

Post on 08-Jul-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

5/28/2018

1

What’s New in Db2 for i 7.3+

—Doug MackDb2 for i Analytics ConsultantIBM Systems Lab Services

© 2016 IBM Corporation

Welcome to the Waitless World

Db2 for i •Standard compliant•Secure•Scalable•Functionally Advanced•Excellent Performance •Easier to use•Easier to maintain

IBM i 7.1

▪XML Support

▪Encryption enhancements (FIELDPROCs)

▪Result set support in embedded SQL

▪CURRENTLY COMMITTED

▪MERGE

▪Global variables

▪Array support in procedures

▪Three-part names and aliases

▪SQE Logical file support

▪EVI enhancements

▪ Inline functions

▪CREATE OR REPLACE

▪DECLARE GLOBAL TEMPORARY TABLE

▪Catalog views

IBM i 7.2

▪Row and Column Access Control

▪XMLTABLE

▪CONNECT BY

▪OLAP Extensions

▪TRANSFER OWNERSHIP

▪Named arguments and defaults for parameters

▪Obfuscation of SQL routines

▪Array support in UDFs

▪Timestamp precision

▪Multiple-action Triggers

▪Built-in Global Variables

▪1.7 Terabyte Indexes

▪Navigator Graphing and Charting

▪System Limits for IFS

IBM i 7.3

▪Temporal

▪Generated columns for auditing

▪OLAP Extensions

▪Regression Functions / Covariance

▪EVI Only Access

▪More Built-in Global Variables

▪More SQL Scalar functions

▪More IBM i Services

▪CREATE OR REPLACE TABLE

▪ATTACH & DETACH PARTITION

▪DBE tooling and automation

▪High priority customer requests

Value Proposition

TR SQL Enhancement

TR5/TR1 JSON_TABLE()

TR7/TR3 JSON Publish

ON GOING ACS Enhancements

ONGOING IBM i and Db2 Services

ONGOING Many Other SQL

Enahancements

How is IBM investing in Db2 for i

Increase the life expectancy and extend the value of legacy applications

5/28/2018

2

© 2016 IBM Corporation

Welcome to the Waitless WorldCognitive Systems

3

Technology Refreshes (TR) delivered via Db2 PTF Groups

www.ibm.com/developerworks/ibmi/techupdates/db2/groupptf

2017 2018

7.2 – TR57.3 – TR1

7.2 – TR67.3 – TR2

Enhancements timed with TR2 & TR6

• JSON predicates

• Additional Database features in ACS

• New and enhanced SQL Scalar

Functions

• New IBM i Services

• Enhanced Db2 for i Services

• And more…

SF99702 Level 14SF99703 Level 3

Enhancements timed with TR1 & TR5

• JSON_TABLE()

• INCLUDE for SQL Routines

• Database features in ACS

• Faster Scalar Functions

• More IBM i Services

• New Db2 for i Services

• And much more…

SF99702 Level 16SF99703 Level 4

SF99702 Level 19SF99703 Level 7

7.2 – TR77.3 – TR3

Enhancements timed with TR3 & TR7

• JSON publishing functions

• Db2 for i generated syslog data

• More LIMIT & OFFSET support

• Additional Database features in

ACS

• New IBM i Services

• And more…

© 2016 IBM Corporation

Welcome to the Waitless WorldCognitive Systems

4

IBM i 7.3 TR3 and IBM i 7.2 TR7

• Announce: October 3, 2017– Book updates in IBM Knowledge Center

– Updates to the IBM i Technology Updates wiki in IBM developerWorks

(dW)

• GA: October 27, 2017– Db2 PTF Groups are released

• dW Enhancement Landing pages…

http://www.ibm.com/developerworks/ibmi/techupdates/i72-TR7

and

http://www.ibm.com/developerworks/ibmi/techupdates/i73-TR3

5/28/2018

3

© 2016 IBM Corporation

Welcome to the Waitless WorldWho benefits from these enhancements?

1. Database Application Developers (including Business Analysts)

New SQL capabilities enable modern

solutions and improved programmer productivity

2. System Administrators and Security Officers

New IBM i Services enable advanced

Systems and Security Management on IBM i

3. Database Engineers

New ACS capabilities provide a

productivity boost to the DBE

4. Your Management’s Perception of IBM i

Continued Investment, Modernization Approaches

Analytics (Db2 Web Query family, Watson)

© 2016 IBM Corporation

Welcome to the Waitless World

Database Revitalization (not just “modernization” – breathe new life into it)

1. Migration

o Reverse engineering the existing DDS database objects to SQL DDL database objects

2. Isolation

o Accessing the new Db2 database via SQL views and IO Data Access modules

3. Correction

o Eliminating design flaws inherited by Db2 from the legacy database

o Use Auto generated columns, strong typing (use date fields), eliminate redundancy of data

4. Protection

o Secure the Db2 database from unauthorized access – with RCAC (7.2)

5. Enhancement

o Enhancing the Db2 database with advanced capabilities

5/28/2018

4

© 2016 IBM Corporation

Welcome to the Waitless WorldWelcome to the Waitless World

Db2 for i&

IBM i

© 2016 IBM Corporation

Welcome to the Waitless World

Major enhancements in Db2 for i deliver significant client value:

o Temporal Tables – History of rows

Data-centric, easily deployed, robust SQL point-in-time capability

o Online Analytical Processing (OLAP) built-in functions

Adding more analytics capabilities directly into Db2 for i

o JSON Support

Easier integration w/ Db2 and applications

o Generated Columns for auditing – Row level identity

Let Db2 maintain the who, what, & how a row came to be

o IBM i Services and Access Client Solutions

o New Db2 Web Query Version 2.2.1

Powerful Visualizations

Db2 for i and IBM i 7.3

5/28/2018

5

© 2016 IBM Corporation

Welcome to the Waitless WorldWelcome to the Waitless World

Db2 for i&

Temporal

© 2016 IBM Corporation

Welcome to the Waitless World

With Temporal Tables, you can answer time-based questions:

o Who was the client rep as of two years ago?

o Who were the client reps over the last five years?

o Produce an inventory report using a different point in time

Db2 for i and Temporal Tables

5/28/2018

6

© 2016 IBM Corporation

Welcome to the Waitless World

Db2 for i – The Old Way: Do It Yourself

Current

Accessing Data

• SELECT

Modifying Data

• INSERT

• UPDATE

• DELETE

History

Accessing Data

• SELECT

Modifying Data

• INSERT

• UPDATE

• DELETE

UNION

Triggers / Programs

© 2016 IBM Corporation

Welcome to the Waitless World

Db2 for i – Another Way: Maintain History in a Data Warehouse

Current

Accessing Data

• SELECT

Modifying Data

• INSERT

• UPDATE

• DELETE

Current+

History

Accessing Data

• SELECT

ETL

Modifying Data

• INSERT

• UPDATE

• DELETE

ETL tool automates

handling of history

data in data model

5/28/2018

7

© 2016 IBM Corporation

Welcome to the Waitless World

What’s New: Db2 Temporal Tables

Current

Accessing Data

• SELECT

Modifying Data

• INSERT

• UPDATE

• DELETE

History

Accessing Data

• SELECT

Modifying Data

• INSERT

• UPDATE

• DELETE (DBE Only)

System Managed

© 2016 IBM Corporation

Welcome to the Waitless World

o SQL statements just reference the current table

o New clauses on the SELECT statement

o FOR SYSTEM TIME AS OF <value>

o FOR SYSTEM TIME FROM <value> TO <value>

o FOR SYSTEM TIME BETWEEN <value> AND <value>

o New special register

o CURRENT TEMPORAL SYSTEM_TIME

Accessing a Temporal Table

5/28/2018

8

© 2016 IBM Corporation

Welcome to the Waitless World

ALTER TABLE accountADD COLUMN row_birthTIMESTAMP(12) NOT NULL IMPLICITLY HIDDENGENERATED ALWAYS AS ROW BEGIN

ADD COLUMN row_deathTIMESTAMP(12) NOT NULL IMPLICITLY HIDDENGENERATED ALWAYS AS ROW END

ADD COLUMN transaction_timeTIMESTAMP(12) IMPLICITLY HIDDENGENERATED ALWAYS AS TRANSACTION START ID

ADD PERIOD SYSTEM_TIME (row_birth, row_death)

CREATE TABLE account_hist LIKE account

ALTER TABLE account ADD VERSIONING USE HISTORY TABLE account_hist

Create history table

Establish birth/death of a row

Enable Temporal tracking

Temporal construction for data-centric history

© 2016 IBM Corporation

Welcome to the Waitless World

With Db2 Temporal Tables, you can:

o Who was the client rep as of two years ago?

SELECT CLIENT_REP FROM ACCOUNTS

FOR SYSTEM_TIME AS OF CURRENT TIMESTAMP – 2 YEARS

o Who were the client reps over the last five years?

SELECT CLIENT_REP FROM ACCOUNTS

FOR SYSTEM_TIME FROM CURRENT TIMESTAMP – 5 YEARS

TO CURRENT TIMESTAMP

o Produce an inventory report using a different point in time

SET CURRENT TEMPORAL SYSTEM_TIME '2016-03-22 17:00:00';

CALL GENERATE_INVENTORY_REPORT();

Move Work to Db2 for i Example: Temporal Tables (7.3)

5/28/2018

9

© 2016 IBM Corporation

Welcome to the Waitless WorldWelcome to the Waitless World

Db2 for i&

OLAP

© 2016 IBM Corporation

Welcome to the Waitless World

SQL OLAP Specification Extensions

On-Line Analytical Processing (OLAP) specifications provide the ability to return ranking, row

numbering, and other aggregate function information as a scalar value in a query result. RANK,

DENSE_RANK, and ROW_NUMBER were added in IBM i 6.1.

SELECT workdept, lastname, salary,

RANK() OVER(PARTITION BY workdept ORDER BY salary DESC) rank,

DENSE_RANK() OVER(PARTITION BY workdept ORDER BY salary DESC) dense_rank,

ROW_NUMBER() OVER(ORDER BY workdept, lastname) row_number

FROM employee ORDER BY workdept, lastname

WORKDEPT LASTNAME SALARY RANK DENSE_RANK ROWNBR

AOO HAAS 52,750,00 1 1 1

AOO HEMMINGER 46,500.00 2 2 2

AOO LUCCHESSI 46,500.00 2 2 3

AOO O'CONNELL 29,250.00 4 3 4

AOO ORLANDO 29,250.00 4 3 5

5/28/2018

10

© 2016 IBM Corporation

Welcome to the Waitless World

SQL Query Engine and OLAP Specification Extensions

With IBM i 7.3, Db2 for i supports the following additional OLAP specifications for

summarizing and referencing rows within windows of result sets:

▪ Aggregates (SUM, COUNT, etc.)

▪ LAG and LEAD

▪ NTILE

▪ FIRST_VALUE, NTH_VALUE, and LAST_VALUE

▪ RATIO_TO REPORT

▪ CUME_DIST

What is the value of this?

▪ You could build analytical applications with much less complexity

▪ BI tools like Db2 Web Query and Cognos can “push the work” to Db2 for better performance

© 2016 IBM Corporation

Welcome to the Waitless World

Scalar Aggregate Functions SUM and PARTITION BY

SELECT store, region, sales,

SUM(sales) OVER(PARTITION BY region) region_total,

DECIMAL(100*sales / SUM (sales) OVER(PARTITION BY region), 5,2) percentage

FROM stores ORDER BY region, percentage

Return the detail store information and the total sales by region plus the percentage the

store contributed to the total for the region:

STORE REGION SALES REGION_TOTAL PERCENTAGE

Wally NE 150,000.00 450,000.00 33.33

Pensk NE 300,000.00 450,000.00 66.66

Bobs NW 100,000.00 1,040,000.00 9.61

Toms NW 440,000.00 1,040,000.00 42.30

Mills NW 500,000.00 1,040,000.00 48.07

Window 1

Window 2

5/28/2018

11

© 2016 IBM Corporation

Welcome to the Waitless World

Rolling Sum Scalar Aggregate OLAP example

Return the detail store information and the rolling sum of the store sales:

SELECT store, region, sales,

SUM(sales) OVER(ORDER BY sales DESC) rolling_sum

FROM stores ORDER BY rolling_sum

STORE REGION SALES ROLLING_SUM

Caining SW 770,000.00 770,000.00

Mills NW 500,000.00 1,270,000.00

Toms NW 440,000.00 1,710,000.00

Menes SW 400,000.00 2,110,000.00

BBB SE 350,000.00 2,460,000.00

© 2016 IBM Corporation

Welcome to the Waitless World

OLAP Specifications - Aggregate

• Given daily inventory levels for each item, compute a 30 day running average for each day for a

specified item

• Assume inventory levels are measured every day resulting in a row for each item, every day of the year

(i.e. there are no missing dates)

• Use a window aggregation group specification to specify the 30 day moving window

D1D2D3D4D5D6D7D8D9D10D11D12D13D14D15D16D17D18D19D20D21D22D23D24D25D26D27D28D29D30D31D1D2D3D4D5

Current

row+ preceding 29 days

Aggregation group

Compute average and associate with this row

Ascending inventory dates for each item

5/28/2018

12

© 2016 IBM Corporation

Welcome to the Waitless World

OLAP Specifications - AggregateOLAP Specification

WITH CTE (ITEM_NO, INVENTORY_DATE, MOVING_30_DAY_AVG) AS

(

SELECT D.ITEM_NO,

D.INVENTORY_DATE,

AVG(D.DAILY_QUANTITY) OVER (

PARTITION BY D.ITEM_NO

ORDER BY D.INVENTORY_DATE

ROWS BETWEEN 29 PRECEDING AND CURRENT ROW)

AS MOVING_30_DAY_AVG

FROM DAILY_INVENTORY D

WHERE D.ITEM_NO = 673091

AND D.INVENTORY_DATE BETWEEN DATE('2015-01-01') - 2 MONTHS AND '2015-12-31'

)

SELECT C.ITEM_NO,

C.INVENTORY_DATE,

C.MOVING_30_DAY_AVG

FROM CTE C

WHERE C.INVENTORY_DATE BETWEEN '2015-01-01' AND '2015-12-31'

ORDER BY C.ITEM_NO,

C.INVENTORY_DATE;

© 2016 IBM Corporation

Welcome to the Waitless World

Db2 Web Query Report Built over SQL View Containing OLAP Function

ITEM

NUMBER

INVENTORY

DATE

MOVING 30 DAY

AVERAGE

673091 2015-02-01 17.00

673091 2015-02-02 13.25

673091 2015-02-03 11.40

673091 2015-02-04 12.33

673091 2015-02-05 14.71

673091 2015-02-06 13.75

673091 2015-02-07 16.11

673091 2015-02-08 15.90

673091 2015-02-09 15.27

673091 2015-02-10 14.58

673091 2015-02-11 16.23

673091 2015-02-12 16.85

… … …

Computed for, and from this day plus 29 preceding days

5/28/2018

13

© 2016 IBM Corporation

Welcome to the Waitless World

First_Value, Last_Value, Nth_Value – OLAP Aggregate functions

SELECT store, sales,

sales - FIRST_VALUE(sales) OVER (ORDER BY sales DESC RANGE BETWEEN

UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) behind_1st,

sales - NTH_VALUE(sales,2) OVER (ORDER BY sales DESC RANGE BETWEEN

UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) behind_2nd,

sales - LAST_VALUE(sales) OVER (ORDER BY sales DESC RANGE BETWEEN

UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) compared_to_last

FROM stores ORDER BY sales DESC

Compare the sales of the current store to the store with the best sales, second best sales, and the worst

sales results:

STORE SALES BEHIND_1ST BEHIND_2ND COMPARED_TO_LAST

Caining 770,000.00 0.00 270,000.00 670,000.00

Mills 500,000.00 -270,000.00 0.00 400,000.00

.. … … … …

Bobs 100,000.00 -670,000.00 -400,000.00 0.00

© 2016 IBM Corporation

Welcome to the Waitless World

Lag and Lead – Ordered OLAP specifications

Compare the sales of stores within the same region including comparisons to the stores

that were adjacent in terms of better and worse sales:

SELECT store, region, sales,

sales - LAG(sales,1) OVER(PARTITION BY region ORDER BY sales) AS prior_diff,

LEAD(sales,1) OVER(PARTITION BY region ORDER BY sales) - sales AS next_diff

FROM stores ORDER BY region, sales

STORE REGION SALES PRIOR_DIFF NEXT_DIFF

Bobs NW 100,000.00 - 340,000.00

Toms NW 440,000.00 340,000.00 60,000.00

Mills NW 500,000.00 60,000.00 -

Targe SW 140,000.00 - 260,000.00

Menes SW 400,000.00 260,000.00 370,000.00

Caining SW 770,000.00 370,000.00 -

5/28/2018

14

© 2016 IBM Corporation

Welcome to the Waitless World

NTILE and Ratio_To_Report – Ordered OLAP specification and aggregate function

Calculate the quartile ranking for all stores and show their overall sales percentage within the region:

SELECT store, region, sales,

NTILE(4) OVER(ORDER BY sales DESC) quartile_rank,

DECIMAL(RATIO_TO_REPORT(sales) OVER() *100, 10, 2) percent

FROM stores ORDER BY sales DESC

STORE REGION SALES QUARTILE_RANK PERCENT

Caining SW 770,000.00 1 21.10

Mills NW 500,000.00 1 13.70

Toms NW 440,000.00 1 12.05

Menes SW 400,000.00 2 10.96

… …. …. … …

Bobs NW 100,000.00 4 2.74

© 2016 IBM Corporation

Welcome to the Waitless World

SQL OLAP Specification Extensions for Statistics

With IBM i 7.3, Db2 for i also supports the following OLAP specifications for statistical

analysis:

▪ Correlation

▪ Covariance

▪ Percentile

▪ Median

▪ Linear regression (slope, intercept, etc.)

https://en.wikipedia.org/wiki/Regression_analysis

Regression analysis is a statistical process for estimating

the relationships among variables.

5/28/2018

15

© 2016 IBM Corporation

Welcome to the Waitless World

Salary Analysis

• Your HR department wants to ensure salaries are equitable across the company and across

departments and there aren’t outliers or other discrepancies

– What is the employee’s salary compared to the average WITHIN their department?

– What is an employee’s ratio of salary within their department and overall company?

– For each employee, compare their salary to the two closest behind this person’s salary, and the

two closest ahead of them in salary

© 2016 IBM Corporation

Welcome to the Waitless World

The Process

• Create a SQL Views (or script) using new 7.3 SQL Extensions

View for Salary compared to AVERAGEView for 2 ahead, 2 behind

5/28/2018

16

© 2016 IBM Corporation

Welcome to the Waitless World

The Process

• Within Db2 Web Query, create a “synonym” (term for meta data) over each of the SQL Views

These are fields

returned from the view

© 2016 IBM Corporation

Welcome to the Waitless World

The Process

• Build Your Reports/Charts/Dashboards with Db2 Web Query InfoAssist

– Add additional filters or virtual fields

– Format header/footer/stylesheet

– Choose output

o Excel, HTML, mobile

– Add to dashboard

– Embed in your app

– Feed into your data warehouse

These are fields

returned from the view

and available in your

report

5/28/2018

17

© 2016 IBM Corporation

Welcome to the Waitless World

Examples

© 2016 IBM Corporation

Welcome to the Waitless WorldWelcome to the Waitless World

Db2 for i&

JSON

5/28/2018

18

© 2016 IBM Corporation

Welcome to the Waitless WorldCognitive Systems

35

JSON support in Db2 for i

Db2

JSON

Store

June

2015

JSON_TABLE()

November

2016

JSON

Predicates:

• IS JSON

• JSON_EXISTS

JSON Scalar functions:

• JSON_QUERY

• JSON_VALUE

JSON Publishing

functions:

• JSON_ARRAY

• JSON_ARRAYAGG

• JSON_OBJECT

• JSON_OBJECTAGG

March

2017

October

2017

© 2016 IBM Corporation

Welcome to the Waitless WorldCognitive Systems

36

Consuming web services with Db2 for i

IBM i 7.1 and

higher

IBM i 7.2 and

higher

October, 2016

5/28/2018

19

© 2016 IBM Corporation

Welcome to the Waitless World

Rows and Columns (i.e. a “table”)

JSON “document”

JSON_TABLE function

Getting Weather Data From IBM Cloud (API returns the data in JSON)

© 2016 IBM Corporation

Welcome to the Waitless World

Use JSON_TABLE to Shred DataGet Weather Almanac Information for Rochester Mn for Aug 10th

SELECT * FROM JSON_TABLE(SYSTOOLS.HTTPGETCLOB

('https://[email protected]/api/weather/v1/location/55901%3A4%3AUS/almanac/daily.json?

units=e&start=0810' ,'') , '$'

COLUMNS(STATION_ID VARCHAR(100) PATH '$.almanac_summaries.station_id',

STATION_NAME VARCHAR(100) PATH '$.almanac_summaries.station_name',

ALMANAC_DATE VARCHAR(100) PATH '$.almanac_summaries.almanac_dt',

INTERVAL VARCHAR(100) PATH '$.almanac_summaries.interval',

AVERAGE_HIGH_TEMP VARCHAR(100) PATH '$.almanac_summaries.avg_hi' ,

AVERAGE_LOW_TEMP VARCHAR(100) PATH '$.almanac_summaries.avg_lo',

RECORD_HIGH_TEMP VARCHAR(100) PATH '$.almanac_summaries.record_hi',

RECORD_HIGH_YEAR VARCHAR(100) PATH '$.almanac_summaries.record_hi_yr',

RECORD_LOW_TEMP VARCHAR(100) PATH '$.almanac_summaries.record_lo',

RECORD_LOW_YEAR VARCHAR(100) PATH '$.almanac_summaries.record_lo_yr',

MEAN_TEMP VARCHAR(100) PATH '$.almanac_summaries.mean_temp',

AVERAGE_PRECIPITATION VARCHAR(100) PATH '$.almanac_summaries.avg_precip',

AVERAGE_SNOW VARCHAR(100) PATH '$.almanac_summaries.avg_snow‘ )

) AS ALMANAC_SUMMARIES;

5/28/2018

20

© 2016 IBM Corporation

Welcome to the Waitless WorldCognitive Systems

39

JSON Publishing Functions

• Embed JSON_OBJECT calls to return documents within

documents

-- Produce an embedded JSON object per department--SELECT JSON_OBJECT(KEY 'department'

VALUE (JSON_OBJECT(KEY 'Id' VALUE x.deptno)))

AS DEPT_JSON FROM toystore.dept x;

© 2016 IBM Corporation

Welcome to the Waitless WorldWelcome to the Waitless World

Db2 for i&

Row Level Auditing

5/28/2018

21

© 2016 IBM Corporation

Welcome to the Waitless World

Enhanced data-centric auditing – with autogenerated columns

• Auto-generated columns are a very powerful building block for datacenricprogramming in that they direct the database to automatically generate column values for you.

• Prior to IBM i 7.3, Db2 for i supported:• IDENTITY columns (which are very good for surrogate primary keys)

• ROW CHANGE TIMESTAMP (which records the time whenever a row is changed)

• The SQL syntax GENERATED ALWAYS prevents anyone from modifying those column values, including a knowledgeable hacker.

• IBM i 7.3 includes support for additional options:– DATA CHANGE OPERATION (I/U/D)

– Special register

– Built-in Global Variable

© 2016 IBM Corporation

Welcome to the Waitless World

Autogenerated columns – DATA CHANGE OPERATION

• DATA CHANGE OPERATION is a one character value recording the last data change:

• I = Insert

• U = Update

• D = Delete

• These work well with temporal tables in that history table will provide a timeline of what changes were made and when.

• The Delete record will be included if the temporal table was configured with the ON DELETE ADD EXTRA ROW clause.

ALTER TABLE fact_table

ADD COLUMN audit_type_change CHAR (1)

GENERATED ALWAYS AS (DATA CHANGE OPERATION)

5/28/2018

22

© 2016 IBM Corporation

Welcome to the Waitless World

Autogenerated columns – special registers

• Special registers can be used to record information about the user making the change and/or the application environment.

• Client registers can be set by the application:

• Web users might access IBM i data using a generic user profileof WEBUSER.

• The application can use the CURRENT CLIENT_USERID special register to record that the user name at the web interface is JIM.

• SESSION_USER and USER contain the user profile currently in use which identifies who is making a change to the database.

ALTER TABLE fact_table

ADD COLUMN audit_app_client_userid VARCHAR(255)

GENERATED ALWAYS AS (CURRENT CLIENT_USERID)

ADD COLUMN audit_user VARCHAR(128)

GENERATED ALWAYS AS (SESSION_USER)

© 2016 IBM Corporation

Welcome to the Waitless World

Autogenerated columns – built-in global variables

• Built-in global variables are managed by the system and provide additional environmental information.

• You can use these to monitor things like which job or which IP address is being used to make a change to the database.

ALTER TABLE fact_table

ADD COLUMN audit_job_name VARCHAR(28)

GENERATED ALWAYS AS (QSYS2.JOB_NAME)

ADD COLUMN audit_client_IP VARCHAR(128)

GENERATED ALWAYS AS (SYSIBM.CLIENT_IPADDR)

5/28/2018

23

© 2016 IBM Corporation

Welcome to the Waitless WorldWelcome to the Waitless World

IBM i Services&

Access Client Solutions (ACS)

© 2016 IBM Corporation

Welcome to the Waitless World

Access Client Solutions

Windows

Install Only

Any Device

Download from here: http://ibm.biz/IBMi_ACS

5/28/2018

24

© 2016 IBM Corporation

Welcome to the Waitless WorldACS Version 1.1.7.1 (July, 2017)

• General

– Add Database Health Center

– Add help text to dialogs

• Run SQL Scripts

– Add Performance Monitor pulldown

– Direct launch buttons

– More Insert from Examples

• SQL Performance Center

– Import SQL Performance Monitor

– Import SQL Plan Cache Snapshot

– Import SQL Plan Cache Event Monitor

– New SQL Performance Monitor

– New SQL Plan Cache Snapshot

– New SQL Plan Cache Event Monitor

• Schemas

– Journal - View Entries

– Add Include... filtering support for

Tables and Indexes

– All Objects - Permissions action

© 2016 IBM Corporation

Welcome to the Waitless WorldCognitive Systems

48

ACS Version 1.1.7.2 (released October/2017)

• Database Maintenance– Alter Tables

– Index Builds

– Reorganize Physical File Member

– Other long running DB operations

• Schemas– More actions

– More columns for Tables

• Run SQL Scripts– Custom Border Settings

– More Insert from Examples

5/28/2018

25

© 2016 IBM Corporation

Welcome to the Waitless WorldCognitive Systems

49

ACS Version 1.1.7.3 (February, 2018)

• Enhancements to Database:

– More integration between Schemas and Run SQL Scripts (RFE

108105).

– Improved sorting for Show Statements in the SQL Performance

Center.

– Support for Properties, Start/End and Swap Receivers has been

added to Journal.

– A legend has been added to Visual Explain.

• Enhancements to Data Transfer:

– Performance improvements when downloading large files especially to

files of type txt, csv, dsr.

© 2016 IBM Corporation

Welcome to the Waitless WorldIBM i Services

• What are IBM i Services?

– SQL Based solutions to common CL or API type commands

– Delivered as SQL Views, User Defined Functions or Stored Procedures

o All of which can be made available for use in Db2 Web Query reports

o SQL Script examples provided in iNav and ACS Run SQL Scripts

– Easier to get system information via SQL Based visualization tools like….Db2 Web Query

• Services are there today

– Depending on TR and IBM i OS level

• Db2 Web Query can be leveraged to build reports, charts/graphs, dashboards or populate

spreadsheets over the data returned from the various services

• Sample reports to be shipped in Q4 – stay tuned to my blog: [email protected]

5/28/2018

26

© 2016 IBM Corporation

Welcome to the Waitless WorldCognitive Systems

51

IBM i Services Timeline

2017

Services in 2016:

• HISTORY_LOG_INFO

• JOB_INFO

• OUTPUT_QUEUE_INFO

• AUTHORITY_COLLECTION

• Many enhanced services

2018

Services in 1Q/2017:

• OBJECT_PRIVILEGES

• MESSAGE_QUEUE_INFO

• LICENSE_EXPIRATION_CHECK

• Enhanced USER_INFO

• Enhanced LICENSE_INFO

• AUTHORIZATION_LIST_INFO

• AUTHORIZATION_LIST_USER_INFO

7.2 – TR57.3 – TR1

7.2 – TR67.3 – TR2

7.2 – TR77.3 – TR3

Services in 4Q/2017:

• Syslog detail returned from

DISPLAY_JOURNAL &

HISTORY_LOG_INFO

• ASP_INFO

• ASP_VARY_INFO

• JOB_QUEUE_INFO

• STACK_INFO

• And more…

http://ibm.biz/Db2foriServices

© 2016 IBM Corporation

Welcome to the Waitless World

PTF Services

QSYS2.GROUP_PTF_INFO – VIEW

QSYS2.PTF_INFO – VIEW

SYSTOOLS.GROUP_PTF_CURRENCY – VIEW

SYSTOOLS.GROUP_PTF_DETAILS – VIEW

http://ibm.biz/Db2foriServices

http://www.ibm.com/developerworks/ibmi/techupdates/db2/landscape

Security Services

QSYS2.AUTHORITY_COLLECTION – VIEW

QSYS2.AUTHORIZATION_LIST_INFO – VIEW

QSYS2.AUTHORIZATION_LIST_USER_INFO – VIEW

QSYS2.DRDA_AUTHENTICATION_ENTRY_INFO – VIEW

QSYS2.FUNCTION_INFO – VIEW

QSYS2.FUNCTION_USAGE – VIEW

QSYS2.GROUP_PROFILE_ENTRIES – VIEW

QSYS2.OBJECT_PRIVILEGES – VIEW

QSYS2.SQL_CHECK_AUTHORITY – UDF

QSYS2.USER_INFO – VIEW

SYSPROC.SET_COLUMN_ATTRIBUTE – PROCEDURE

Communication Services

QSYS2.NETSTAT_INFO – VIEW

QSYS2.NETSTAT_INTERFACE_INFO – VIEW

QSYS2.NETSTAT_JOB_INFO – VIEW

QSYS2.NETSTAT_ROUTE_INFO – VIEW

QSYS2.SERVER_SBS_ROUTING – VIEW

QSYS2.SET_SERVER_SBS_ROUTING – PROCEDURE

QSYS2.TCPIP_INFO – VIEW

SYSIBMADM.ENV_SYS_INFO – VIEW

Work Management Services

QSYS2.ACTIVE_JOB_INFO – UDTF

QSYS2.GET_JOB_INFO – UDTF

QSYS2.JOB_INFO – UDTF

QSYS2.JOB_QUEUE_INFO – VIEW

QSYS2.MEMORY_POOL – UDTF

QSYS2.MEMORY_POOL_INFO – VIEW

QSYS2.OBJECT_LOCK_INFO – VIEW

QSYS2.RECORD_LOCK_INFO – VIEW

QSYS2.SCHEDULED_JOB_INFO – VIEW

QSYS2.SYSTEM_STATUS – UDTF

QSYS2.SYSTEM_STATUS_INFO – VIEW

QSYS2.SYSTEM_VALUE_INFO – VIEW

System Health ServicesQSYS2.SYSLIMITS – VIEW

QSYS2.SYSLIMTBL – TABLE

Application Services

Journal Services

QSYS2.DISPLAY_JOURNAL – UDTF

QSYS2.JOURNAL_INFO – VIEW

Storage Services

QSYS2.ASP_INFO – VIEW

QSYS2.ASP_VARY_INFO – VIEW

QSYS2.MEDIA_LIBRARY_INFO – VIEW

QSYS2.SYSDISKSTAT – VIEW

QSYS2.SYSTMPSTG – VIEW

QSYS2.USER_STORAGE – VIEW

IBM® i Services

QSYS2.ENVIRONMENT_VARIABLE_INFO – VIEW

QSYS2.QCMDEXC – PROCEDURE

QSYS2.SERVICES_INFO – TABLE

QSYS2.SET_PASE_SHELL_INFO – PROCEDURE

QSYS2.STACK_INFO – UDTF

Librarian Services

QSYS2.LIBRARY_LIST_INFO – VIEW

QSYS2.OBJECT_STATISTICS – UDTF

Message Handling Services

QSYS2.HISTORY_LOG_INFO – UDTF

QSYS2.JOBLOG_INFO – UDTF

QSYS2.MESSAGE_QUEUE_INFO – VIEW

QSYS2.REPLY_LIST_INFO – VIEW

Java Services

QSYS2.JVM_INFO – VIEW

QSYS2.SET_JVM – PROCEDURE

IBM i Services

QSYS2.LICENSE_INFO – VIEW

SYSTOOLS.LICENSE_EXPIRATION_CHECK – PROCEDURE

QSYS2.OUTPUT_QUEUE_ENTRIES – VIEW

QSYS2.OUTPUT_QUEUE_ENTRIES – UDTF

QSYS2.OUTPUT_QUEUE_INFO – VIEW

Product Services

Spool Services

5/28/2018

27

© 2016 IBM Corporation

Welcome to the Waitless WorldCognitive Systems

53

Performance Improvements

• The following services are faster at IBM i 7.2 and 7.3:

– QSYS2.AUTHORIZATION_LIST_INFO

– QSYS2.AUTHORIZATIONS

– QSYS2.GROUP_PROFILE_ENTRIES

– QSYS2.MESSAGE_QUEUE_INFO

– QSYS2.USER_INFO

– QSYS2.USER_STORAGE

© 2016 IBM Corporation

Welcome to the Waitless WorldSample Reports in Db2 Web Query: CPU Utilization Dashboard

• Supports one or multiple LPARs/Servers

➢ System CPU Utilization

➢ Can be easily extended to other system

metrics

• Auto Refresh Enabled

➢ Remote data collection requires remote

system connections to be set up (RDB

directory entries and SVRAUTE entries)

• Continues to collect and store historical data

using a Stored Procedure once the report is

initially run

➢ Stops collecting if ‘no one is watching’ for an

extended period of time

5/28/2018

28

© 2016 IBM Corporation

Welcome to the Waitless WorldMonitoring Output Queues and Spool Files

• Are you cleaning up your spool files?

Top 10 output

queues by #

of spool files

Top 10

users by #

of spool

files

© 2016 IBM Corporation

Welcome to the Waitless WorldSystem Status

• Various metrics across all LPARs/Servers• Not set up as auto refresh but could be easily enough• Traffic lighting to highlight potential problems

• You could easily change the report to include your own thresholds to monitor

5/28/2018

29

© 2016 IBM Corporation

Welcome to the Waitless WorldAvailable as Part of Db2 Web Query EZ-Install

• Earlier this year we introduced a simple way of installing and getting

immediate value out of Db2 Web Query

– EZ-Install Package

o Includes Sample reports/dashboards that a Systems Admin might be interested in

o Db2 Web Query audit reports/dashboards

o Automated setup so you can immediately run with the over 14 chapters of self guided tutorials

– And we also include the completed tutorial reports so you have over 50 sample reports/dashboards

o Query/400 Discovery Tool

o Must be at 7.1 or above

• To Request, send email to [email protected]

– Include name, company name, and serial number where you plan to install

© 2016 IBM Corporation

Welcome to the Waitless WorldWelcome to the Waitless World

Db2 Web Query for iNew Version 2.2.1

5/28/2018

30

© 2016 IBM Corporation

Welcome to the Waitless WorldDb2 Web Query for i

• From Query/400 Modernization to Business

Intelligence

• Operational Reporting or Automate Building of Data

Warehouse/ Data Mart Infrastructures

• Simplify Report Authoring by untangling data and

documenting relationships/rules

• Deliver information to those that need it the most, in

the forms they desire – while maintaining “single

version of the truth”

– Dashboards

– Spreadsheets

– PDF

– Mobile Devices

– Embedded in your own applications

59

© 2016 IBM Corporation

Welcome to the Waitless WorldBased on an Industry Best Practice “Meta Data” Layer

Files/Tables

SQL Views SQL Scripts Aggregated Data

(MQTs)

Programs (defined

as Stored Procs)

Date AttributesUser Defined

Functions

SQL Functions

Non Db2 for i

Data Sources

Excel

Calculated Fields

DATA SOURCES

Single

Version

of the

TRUTH

Reports/Dashboards/Visualizations or even a Data Warehouse

Data Warehouse

BIETL

Query/400

60

SYNONYMS = Meta Data

5/28/2018

31

© 2016 IBM Corporation

Welcome to the Waitless World

61

Db2 Web Query DataMigrator ETL Extension

▪ Extract, Transformation and Load Functions

‒ Automate consolidation, organization, “untangling” and optionally, the

building of a data warehouse or data mart

‒ Consolidate data from many different data sources

‒ Build transforms through SQL, RPG, use of built in or Db2 functions,

etc.

‒ Can create flat files, relational, incorporate lobs (e.g., XML, JSON)

‒ Run data flows off of IBM i job scheduler

▪ Integrated with IBM i and Db2 for i

‒ All components run in IBM i

‒ CL Commands, PTF Management, Security, Licensing is all IBM i

▪ INTEGRATED with Db2 Web Query Business Intelligence

‒ Can leverage meta data created with Db2 Web Query or vice versa

‒ Shared services and administration

Come to the session at 1 for more info

© 2016 IBM Corporation

Welcome to the Waitless WorldCognitive Systems

62

Db2 Web Query Version 2.2.1

• Steps beyond traditional Business Intelligence into Data Discovery

– New data driven Visualization empowers:

Users, Analysts, and Data scientists

– Data layers (e.g., demographics) for geographic maps

What is the average income in this zip code?

• Consolidate, Prepare, and Transform Data with DataMigrator ETL

– Even augment existing data with data from Watson

• Install or upgrade in 15 minutes with the “EZ-Install” Package

Includes 100’s of sample reports, for the business and I/T

Learn more at

ibm.biz/db2webqueryi

& db2webqueryi.blogspot.com

GA 12/08/2017

No Charge Upgrade from previous versions**

* QRY/400 owners entitled to Web Query Express w/ limited # of user licenses for no charge

** Assumes currency on SW Maintenance

5/28/2018

32

© 2016 IBM Corporation

Welcome to the Waitless World

63

To Learn More

• Db2 Web Query for i Website

– Ibm.biz/db2webqueryi

• Db2 Web Query for i Wiki

– Ibm.co/db2wqwiki

• Db2 Web Query Getting Started Enablement:

– https://ibm.biz/db2wqconsulting

• Demonstrations:

– Wizard Analytics: https://ibm.biz/Db2WQWizards

– End User Demos: https://ibm.biz/db2wqreportingdemos

• Follow Db2 Web Query guy Doug Mack on twitter at

@mckdrmoly or check out his blog at

http://db2webqueryi.blogspot.com/ for all the latest

© 2016 IBM Corporation

Welcome to the Waitless WorldWelcome to the Waitless World

Db2 for iNew/Updated

Redbooks

5/28/2018

33

© 2016 IBM Corporation

Welcome to the Waitless World

Db2 for i – SQL Programming Resources

www.redbooks.ibm.com/redpieces/abstracts/sg248326.html

Essential resource for SQL & Db2

for i database application

development

Draft published: March 2016

© 2016 IBM Corporation

Welcome to the Waitless World

Db2 for i – RCAC Resource

www.redbooks.ibm.com/redpieces/abstracts/redp5110.html

Essential resource for

understanding how Row

Permissions and Column Masks

can be used to limit access to

business critical data

5/28/2018

34

© 2016 IBM Corporation

Welcome to the Waitless World

New Db2 Web Query Nuts and Bolts Redbook for Version 2.2

• New “Nuts and Bolts” Redbook

– Many more topics previously not

covered or updated to cover new

function

• Let‘s talk about Tutorials

– Version 2.1 Tutorials currently

available still apply

– Futures ?

© 2016 IBM Corporation

Welcome to the Waitless World

www.ibm.com/developerworks/ibmi/techupdates/db2

5/28/2018

35

© 2016 IBM Corporation

Welcome to the Waitless World

Please note

• IBM’s statements regarding its plans, directions, and intent are subject to change or withdrawal without notice at IBM’s sole discretion.

• Information regarding potential future products is intended to outline our general product direction and it should not be relied on in

making a purchasing decision.

• The information mentioned regarding potential future products is not a commitment, promise, or legal obligation to deliver any

material, code or functionality. Information about potential future products may not be incorporated into any contract.

• The development, release, and timing of any future features or functionality described for our products remains at our sole discretion.

• Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual

throughput or performance that any user will experience will vary depending upon many factors, including considerations such as

the amount of multiprogramming in the user’s job stream,

the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual

user will achieve results similar to those stated here.

© 2016 IBM Corporation

Welcome to the Waitless World

Notice and disclaimers

• Copyright © 2017 by International Business Machines Corporation (IBM). No part of this document may be reproduced or transmitted in any form without written permission from IBM.

• U.S. Government Users Restricted Rights — use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM.

• Information in these presentations (including information relating to products that have not yet been announced by IBM) has been reviewed for accuracy as of the date of initial publication

and could include unintentional technical or typographical errors. IBM shall have no responsibility to update this information. This document is distributed “as is” without any warranty,

either express or implied. In no event shall IBM be liable for any damage arising from the use of this information, including but not limited to, loss of data, business

interruption, loss of profit or loss of opportunity. IBM products and services are warranted according to the terms and conditions of the agreements under which they are provided.

• IBM products are manufactured from new parts or new and used parts. In some cases, a product may not be new and may have been previously installed. Regardless, our warranty terms

apply.”

• Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without notice.

• Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are presented as illustrations of how those customers have used

IBM products and the results they may have achieved. Actual performance, cost, savings or other results in other operating environments may vary.

• References in this document to IBM products, programs, or services does not imply that IBM intends to make such products, programs or services available in all countries in which

IBM operates or does business.

• Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not necessarily reflect the views of IBM. All materials and discussions

are provided for informational purposes only, and are neither intended to, nor shall constitute legal or other guidance or advice to any individual participant or their specific situation.

• It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal counsel as to the identification and interpretation of any

relevant laws and regulatory requirements that may affect the customer’s business and any actions the customer may need to take to comply with such laws. IBM does not provide legal

advice or represent or warrant that its services or products will ensure that the customer is in compliance with any law.

5/28/2018

36

© 2016 IBM Corporation

Welcome to the Waitless World

Notice and disclaimers continuedInformation concerning non-IBM products was obtained from the

suppliers of those products, their published announcements or

other publicly available sources. IBM has not tested those products

in connection with this publication and cannot confirm the accuracy

of performance, compatibility or any other claims related to non-IBM

products. Questions on the capabilities of non-IBM products should

be addressed to the suppliers of those products. IBM does not

warrant the quality of any third-party products, or the ability of

any such third-party products to interoperate with IBM’s products.

IBM expressly disclaims all warranties, expressed or implied,

including but not limited to, the implied warranties of

merchantability and fitness for a particular, purpose.

The provision of the information contained herein is not intended to,

and does not, grant any right or license under any IBM patents,

copyrights, trademarks or other intellectual property right.

IBM, the IBM logo, ibm.com, AIX, BigInsights, Bluemix, CICS,

Easy Tier, FlashCopy, FlashSystem, GDPS, GPFS,

Guardium, HyperSwap, IBM Cloud Managed Services, IBM

Elastic Storage, IBM FlashCore, IBM FlashSystem, IBM

MobileFirst, IBM Power Systems, IBM PureSystems, IBM

Spectrum, IBM Spectrum Accelerate, IBM Spectrum Archive,

IBM Spectrum Control, IBM Spectrum Protect, IBM Spectrum

Scale, IBM Spectrum Storage, IBM Spectrum Virtualize, IBM

Watson, IBM z Systems, IBM z13, IMS, InfoSphere, Linear

Tape File System, OMEGAMON, OpenPower, Parallel

Sysplex, Power, POWER, POWER4, POWER7, POWER8,

Power Series, Power Systems, Power Systems Software,

PowerHA, PowerLinux, PowerVM, PureApplica- tion, RACF,

Real-time Compression, Redbooks, RMF, SPSS, Storwize,

Symphony, SystemMirror, System Storage, Tivoli,

WebSphere, XIV, z Systems, z/OS, z/VM, z/VSE, zEnterprise

and zSecure are trademarks of International Business

Machines Corporation, registered in many jurisdictions

worldwide. Other product and service names might

be trademarks of IBM or other companies. A current list of

IBM trademarks is available on the Web at "Copyright and

trademark information" at:

www.ibm.com/legal/copytrade.shtml.

Linux is a registered trademark of Linus Torvalds in the United

States, other countries, or both. Java and all Java-based

trademarks and logos are trademarks or registered

trademarks of Oracle and/or its affiliates.