Front cover

Draft Document for Review January 3, 2010 2:34 pm SG24-7214-01

Getting Started with DB2 Web Query for i
Follow the best practice guides to simplify report development Take your reporting to the next level of Business Intelligence
Learn DB2 Web Query by using the easy to follow tutorials

Hernando Bedoya Robert Andrews Gene Cobb Tyler Even Jackie Jansen Linda Swan

ibm.com/redbooks

Draft Document for Review December 17, 2009 2:29 pm

7214edno.fm

International Technical Support Organization Getting Started with DB2 Web Query for i December 2009

SG24-7214-01

7214edno.fm

Draft Document for Review December 17, 2009 2:29 pm

Note: Before using this information and the product it supports, read the information in “Notices” on page xi.

Second Edition (December 2009) This edition applies to IBM i 6.1 (product number 5761-SS1). This document created or updated on December 17, 2009.
© Copyright International Business Machines Corporation 2009. All rights reserved. Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

Draft Document for Review December 17, 2009 2:29 pm

7214edno.fm

iii

7214edno.fm

Draft Document for Review December 17, 2009 2:29 pm

iv

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:16 pm

7214TOC.fm

Contents
Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The team that wrote this IBM Redbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Become a published author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Comments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii xiv xvi xvi

Summary of changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix December 2009, Second Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Part 1. Background, installation, and setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 1. Product architecture and overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1 Query/400: A product history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2 Introduction to DB2 Web Query for i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.3 Synonyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.4 DB2 Web Query features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.4.1 Base features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.4.2 Optional features available from IBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.4.3 Companion products available from IBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.5 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.5.1 Web browser clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.5.2 Web server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.5.3 Application server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.5.4 Reporting Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.5.5 Data adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.6 DB2 Web Query Developer Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.7 DB2 Web Query product positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.8 Request for changes on Web Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Chapter 2. Installation and server operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 Installation and setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Installing DB2 Web Query. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.2 Authorizing and verifying users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.3 License keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.4 Dynamic Language Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.5 Sample Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.1 PC requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.2 System i requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.3 Developer Workbench requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Web Query Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 DB2 Web Query server jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 3. DB2 Web Query fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1 Types of DB2 Web Query users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Licensing DB2 Web Query users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1 Comparing the licensing options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 18 18 19 19 20 20 20 20 21 21 22 22 25 25 26 26

© Copyright IBM Corp. 2009. All rights reserved.

v

7214TOC.fm

Draft Document for Review January 3, 2010 1:16 pm

3.3 Registering named users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.1 Adding a New User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.2 Removing a DB2 Web Query registered User . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.3 Displaying registered users. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 Logging in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5 Administrator tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.1 DB2 Web Query domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.2 Creating subfolders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.3 Assigning authority to users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6 Developer tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.1 Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.2 Setting up a cross-system join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.3 Segmenting and securing Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7 Basic user . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

28 29 29 29 29 31 31 34 35 43 45 72 79 85

Part 2. Tutorials for DB2 Web Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Chapter 4. Getting started with the tutorials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Chapter 5. Report Assistant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 5.1 Tutorial overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 5.2 Report creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 5.2.1 Creating a summary report (RA1_Revenue). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 5.2.2 Defining a report layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 5.2.3 Sum and detail reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 5.2.4 Date formatting (RA2_XTab). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 5.2.5 Selection criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 5.2.6 Cross-tab report (RA2_XTab) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 5.2.7 Creating a sample detail report (RA3_GP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 5.2.8 Conditional styling (traffic lighting) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 5.2.9 Using variables in report headings and footings . . . . . . . . . . . . . . . . . . . . . . . . . 120 5.2.10 Generating subtotals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 5.2.11 Sorting by an aggregate field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 5.2.12 Adding ranking columns (RA4_Advanced) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 5.3 Output options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 5.3.1 On-demand paging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 5.3.2 PDF output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 5.3.3 Excel output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 5.3.4 DB2 database file output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 5.4 Additional report types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 5.4.1 Parameterized reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 5.4.2 Drill-down reports: Parent report (RA5_Child) . . . . . . . . . . . . . . . . . . . . . . . . . . 138 5.4.3 Report properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 5.5 Joining tables (reference only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 5.6 Creating a report over a stored procedure synonym. . . . . . . . . . . . . . . . . . . . . . . . . . 144 5.7 Report Assistant summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Chapter 6. Graph Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1 Tutorial overview: Bar chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 Creating a simple bar chart with drill-down capabilities (GA1_Bar) . . . . . . . . . . . . . . 6.2.1 Adding multiple bars to one chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.2 Adding a drill down to a chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 Creating a dual axis bar and line chart (GA2_Parm) . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.1 Adding a second Y axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
Getting Started with DB2 Web Query for i

151 152 154 156 158 160 163

Draft Document for Review January 3, 2010 1:16 pm

7214TOC.fm

6.4 Creating a revenue trend over time chart (GA3_Line) . . . . . . . . . . . . . . . . . . . . . . . . 6.5 Creating a line graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.1 Adding a date range filter to a line graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.2 Adding a user-specified date range parameter . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6 Working with pie charts (GA4_Pie) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7 Creating a product type pie chart for each year . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8 Conditional styling or traffic lighting a graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 7. Power Painter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1 Tutorial overview (PP1_PDF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 Launching Power Painter and tailoring the main window . . . . . . . . . . . . . . . . . . . . . . 7.3 Building a graph with Power Painter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4 Building a report with Power Painter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5 Adding an image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.6 Building a gauge chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

167 169 176 181 184 184 190 197 198 198 201 209 218 220

Part 3. Tutorials for DB2 Web Query optional features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Chapter 8. Active Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1 Overview and highlights of Active Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.2 Creating a report with Active Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3 Using an Active Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 230 231 235 247

Chapter 9. Developer Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 9.1 Configuring Developer Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 9.2 Setting Developer Workbench default options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Chapter 10. Online analytical processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.1 OLAP terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.2 Defining OLAP metadata using Developer Workbench . . . . . . . . . . . . . . . . . . . . . . 10.3 Enabling an OLAP report (OL1_Revenue) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.4 Working with an OLAP-enabled report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.4.1 Slicing, dicing, and drilling down for more details . . . . . . . . . . . . . . . . . . . . . . . 10.4.2 Manipulating the data using the OLAP Control Panel. . . . . . . . . . . . . . . . . . . . 10.4.3 Grouping data into percentiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 11. HTML Composer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1 Compound parameterized report (HTML1_KPI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1.1 Adding parameters to existing reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1.2 Designing the layout for the HTML report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Highly parameterized report (HTML2_Parm) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2.1 Creating the report in HTML Composer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2.2 Additional parameter tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 12. Additional features of Developer Workbench . . . . . . . . . . . . . . . . . . . . . 12.1 Synonym Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.1 Date Decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.2 Additional date manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.3 Creating filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.4 Joining tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.5 Business View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.6 Impact Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.7 Data profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.2 SQL Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents

257 258 259 266 268 268 279 286 289 290 290 296 305 308 327 343 344 348 350 352 354 361 363 366 369 vii

7214TOC.fm

Draft Document for Review January 3, 2010 1:16 pm

12.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 Chapter 13. DB2 Web Query Spreadsheet Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.2.1 Predefined Server configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.3 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.3.1 Report Assistant mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.3.2 Structured Ad-Hoc Form mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.4 Dashboards in Excel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.5 Data Range Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.6 Spreadsheet Client Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 14. Adapter for Microsoft SQL Server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.2 Establishing a connection to your MS SQL Server . . . . . . . . . . . . . . . . . . . . . . . . . . 14.3 Creating Metadata. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.4 Additional SQL Server Adapter information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 378 378 378 379 379 380 381 382 382 383 384 384 387 390

Part 4. Companion products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 Chapter 15. Report Broker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.1 Tutorial Overview and preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.2 Installing and Configuring Report Broker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.3 Schedule an existing report. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4 Scheduling Frequency options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.5 Creating a Report Broker distribution list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.6 Busting a Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.7 Viewing the Distribution log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.8 Report Broker and Highly Parametrized reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.9 Report Broker Administrator functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.10 Report Broker and Active Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.11 Report Broker and RunTime User Enablement . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.12 Event driven distribution request via RUNBRSCHED . . . . . . . . . . . . . . . . . . . . . . . 15.13 Report Broker Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 16. Software Development Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.1 Overview of the Software Development Kit (SDK) . . . . . . . . . . . . . . . . . . . . . . . . . . 16.2 Uses of the Web Query SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.3 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.4 Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.4.1 Core APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.4.2 Report Broker APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.4.3 Sample code path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.4.4 Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 394 394 397 402 405 407 410 411 412 415 415 416 416 417 418 418 419 419 419 420 420 420

Part 5. Miscellaneous or additional topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 Chapter 17. Using DB2 Web Query to run existing Query/400 reports . . . . . . . . . . . 17.1 Query/400: A reliable reporting tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.2 DB2 Web Query versus Query/400: Function similarities . . . . . . . . . . . . . . . . . . . . . 17.3 DB2 Web Query versus Query/400: Function differences . . . . . . . . . . . . . . . . . . . . 17.4 Creating metadata from Query/400 objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.5 Using DB2 Web Query to edit a QRYDFN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 428 428 429 430 433

viii

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:16 pm

7214TOC.fm

Chapter 18. Performance considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.1 Performance basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2 DB2 CLI adapter performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2.1 Report request process flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2.2 Adapter processing and optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2.3 Remote database access considerations (including cross-system joining) . . . 18.3 Query/400 adapter performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.4 DB2 for i optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.4.1 Database design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.4.2 Query Engine used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.4.3 Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.4.4 Available hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.4.5 Concurrent users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.5 Performance case study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.5.1 Identifying a long running report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.5.2 Performing analysis and looking for optimization disablers . . . . . . . . . . . . . . . 18.5.3 Determining report tuning options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.5.4 Creating an SQL view and synonym. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.5.5 Creating a new report based on the SQL view . . . . . . . . . . . . . . . . . . . . . . . . . 18.5.6 Performing additional database analysis and tuning. . . . . . . . . . . . . . . . . . . . . 18.6 Performance benchmark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.6.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.6.2 Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.6.3 Database and system configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.6.4 Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.6.5 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 19. Frequently Asked Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.1 General announcement or product information questions . . . . . . . . . . . . . . . . . . . . 19.2 Installation and setup questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.3 Security-related questions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.4 Named-user question . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.5 Metadata questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.6 Query/400 migration questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.7 Report development questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.8 Excel spreadsheet integration questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.9 Add-on product questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.10 Save and restore questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.11 Education questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

435 436 436 436 438 448 450 451 451 452 461 462 465 466 466 466 468 468 470 472 474 474 474 475 475 478 479 480 484 484 486 486 489 490 499 501 504 506

Part 6. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509 Appendix A. Metadata in the integrated file system . . . . . . . . . . . . . . . . . . . . . . . . . . 511 Appendix B. ate and time functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Date and time system variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Date format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Date format display options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Controlling the date separator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using date fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Date fields in arithmetic expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Converting date fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Changing the usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using DB2 Web Query functions to convert to dates . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents

513 514 514 514 516 516 516 517 518 521 ix

7214TOC.fm

Draft Document for Review January 3, 2010 1:16 pm

Using date conversion table to convert to dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using SQL Views and functions to convert to dates . . . . . . . . . . . . . . . . . . . . . . . . . . . Comparing the date conversion techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Converting date fields in Oracle’s JD Edwards World application . . . . . . . . . . . . . . . . Converting other common legacy date formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DB2 Web Query date built-in functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DATEADD: Adding or subtracting a date unit to or from a date . . . . . . . . . . . . . . . . . . DATEDIFF: Calculating the difference between two dates . . . . . . . . . . . . . . . . . . . . . . DATEMOV: Moving the date to a significant point . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example: Dynamic Date Range report. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

526 548 551 552 554 555 555 556 556 557

Appendix C. Processing differences between the define and compute fields . . . . . 563 Appendix D. Change Management considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 Developer Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 Without Developer Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 Appendix E. Additional material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Locating the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . System requirements for downloading the Web material . . . . . . . . . . . . . . . . . . . . . . . How to use the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Online resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . How to get IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Help from IBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569 569 569 569 570 571 571 571 571 572

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573

x

Getting Started with DB2 Web Query for i

This information contains examples of data and reports used in daily business operations. the examples include the names of individuals. Any reference to an IBM product.A. Changes are periodically made to the information herein. using. companies. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk. To illustrate them as completely as possible. or service that does not infringe any IBM intellectual property right may be used instead. INCLUDING.S.fm Notices This information was developed for products and services offered in the U. The furnishing of this document does not give you any license to these patents. compatibility or any other claims related to non-IBM products. which illustrate programming techniques on various operating platforms. Some states do not allow disclaimer of express or implied warranties in certain transactions. for the purposes of developing. cannot guarantee or imply reliability. services. North Castle Drive. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice. program. or features discussed in this document in other countries. © Copyright IBM Corp. Consult your local IBM representative for information on the products and services currently available in your area. 2009 2:29 pm 7214spec. THE IMPLIED WARRANTIES OF NON-INFRINGEMENT. xi . program. and distribute these sample programs in any form without payment to IBM. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. These examples have not been thoroughly tested under all conditions.Draft Document for Review December 17. brands. it is the user's responsibility to evaluate and verify the operation of any non-IBM product. Information concerning non-IBM products was obtained from the suppliers of those products. IBM may not offer the products. their published announcements or other publicly available sources. IBM may have patents or pending patent applications covering subject matter described in this document. and products. EITHER EXPRESS OR IMPLIED. IBM has not tested those products and cannot confirm the accuracy of performance. or service. You may copy. IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligation to you. However. This information could include technical inaccuracies or typographical errors. MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. to: IBM Director of Licensing. in writing. Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. IBM Corporation. therefore. serviceability. BUT NOT LIMITED TO. or service may be used. All rights reserved. Any functionally equivalent product. Armonk. NY 10504-1785 U. or function of these programs. IBM. COPYRIGHT LICENSE: This information contains sample application programs in source language.A. therefore. 2009. modify. this statement may not apply to you. program. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental. The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND. You can send license inquiries. these changes will be incorporated in new editions of the publication. program. or service is not intended to state or imply that only that IBM product. marketing or distributing application programs conforming to the application programming interface for the operating platform for which the sample programs are written.S.

A current list of IBM trademarks is available on the Web at http://www. Windows Vista. Intel logo. and ibm.fm Draft Document for Review December 17.shtml The following terms are trademarks of the International Business Machines Corporation in the United States. JVM. other countries. J2EE. other countries. other countries. JDBC. the IBM logo. or both. and the Windows logo are trademarks of Microsoft Corporation in the United States. PowerPoint. or both. or both. Expression. Adobe. Other company. Adobe Reader. PostScript. Pentium. in the United States. other countries. or both: AS/400® DB2® developerWorks® Domino® i5/OS® IBM® iSeries® Lotus® OmniFind® Rational® Redbooks® Redpaper™ Redpapers™ Redbooks (logo) System i5® System i® WebSphere® ® The following terms are trademarks of other companies: Acrobat. and Portable Document Format (PDF) are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States. ActiveX. Excel. and TopLink are registered trademarks of Oracle Corporation and/or its affiliates. Siebel. SQL Server. Inc. JavaServer.com are trademarks or registered trademarks of International Business Machines Corporation in the United States. These and other IBM trademarked terms are marked on their first occurrence in this information with the appropriate symbol (® or ™). Such trademarks may also be registered or common law trademarks in other countries. PeopleSoft. other countries. Internet Explorer.ibm. JD Edwards. other countries. Intel Inside logo. and all Java-based trademarks are trademarks of Sun Microsystems. JavaScript. Windows. product. 2009 2:29 pm Trademarks IBM. or both. or both. Oracle. Microsoft. and Intel Centrino logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States. indicating US registered or common law trademarks owned by IBM at the time this information was published. xii Getting Started with DB2 Web Query for i . Java.7214spec. MS. or service names may be trademarks or service marks of others.com/legal/copytrade.

and Part 3. HTML or through browser support of the Java-based thin client interface. You can extract and use Part 2. customers can modernize existing Query for iSeries reports while providing a foundation for building more complex business intelligence applications. DB2 Web Query offers features to import Query/400 definitions and enhance their look and functionality with Power Painter or Graph Assistant. It entails a group of self-explanatory tutorials to help you get up to speed quickly. “Online analytical processing” on page 257. data mining. as stand-alone tutorials for anyone who is developing their own queries. and productive reporting solution.Draft Document for Review January 3. 2010 1:16 pm 7214pref. xiii . It enables you to build new reports with ease through the Power Painter or Report Assistant and Graph Assistant components. extensible. “Tutorials for DB2 Web Query” on page 87. It provides an interface to all data in IBM i5/OS® through either DB2 or Open Query File native adapters that automatically identify the files to be accessed and import the metadata into DB2 Web Query. “Active Reports” on page 229. IBM DB2 Web Query for i includes Query for iSeries technology to assist customers in their transition to DB2 Web Query. This IBM Redbook publication gives a broad understanding of the new DB2 Web Query product. such as online analytical processing (OLAP). It simplifies the management of reports by allowing you to leverage parameterized reporting. is appropriate for those who work disconnected from the System i® environment. and Power Painter. In addition. or data warehouse implementations. © Copyright IBM Corp. All rights reserved. Much of Chapter 8. It enables you to add OLAP-like slicing and dicing to the reports or to view reports in disconnected mode for users on the go.fm Preface The DB2® Web Query for i product is a Web-based query and report writing product that offers enhanced capabilities over the IBM® Query for iSeries® (also commonly known as Query/400) product. PDF. if you will simply be running OLAP-enabled reports. DB2 Web Query provides Report Assistant. including spreadsheets. DB2 Web Query provides capabilities to query or build reports against data that is stored in DB2 call-level interface (CLI) databases through the latest browser-based user interface technologies. dash boarding. Java™-based solution for a more robust. It offers a more modernized. “Tutorials for DB2 Web Query optional features” on page 227. Overall this book is designed for IT users. 2009. Graph Assistant. It delivers data to users in many different formats. Using these tools. you can use much of Chapter 10.

7214pref.fm

Draft Document for Review January 3, 2010 1:16 pm

The team that wrote this IBM Redbook
This book was produced by a team of specialists from around the world working at the International Technical Support Organization (ITSO), Poughkeepsie Center. Hernando Bedoya is a Senior IT Specialist at STG Lab Services and Training, in Rochester, Minnesota. He writes extensively and teaches IBM classes worldwide in all areas of DB2 for i. Before joining STG Lab Services he worked in the ITSO for 9 years writing multiple redbooks. He also worked for IBM Colombia as an IBM AS/400® IT Specialist doing presales support for the Andean countries. He has 25 years of experience in the computing field and has taught database classes in Colombian universities. He holds a master degree in computer science from EAFIT, Colombia. His areas of expertise are database technology, performance, and data warehousing. Hernando can be contacted at hbedoya@us.ibm.com. Jackie Jansen is the IBM i Solutions Manager for Information Builders specializing in DB2 Web Query. Jackie is the author of a variety of published columns including “Business Intelligence with Jackie” and “Jackie's Forum”. Jackie is a frequent speaker at Technical Conferences and User Group meetings. Contact her at jackie_jansen@ibi.com.

Gene Cobb is a DB2 for i technology specialist in the IBM Systems Software DB2 for i Development team. He joined IBM in 1988 and spent over 10 years as an application consultant in the IBM STG Lab Services group, formerly the Client Technology Center (CTC) in Rochester, Minnesota. His current responsibilities include the promotion, education, enablement, and technical support of IBM DB2 Web Query, the strategic query and reporting solution for the IBM i platform. He speaks and writes regularly about DB2 for i and DB2 Web Query topics, and was a co-author of the IBM Redbook “Getting Started with DB2 Web Query for IBM i” He can be reached at cobbg@us.ibm.com.

Robert Andrews is an Advisory Software Engineer working for the STG Lab Services team in the DB2 for i Center of Excellence. He was the technical head for support for the DB2 Web Query product and currently provides custom consulting services helping clients make the most of DB2 Web Query and DB2 for i. Since joining IBM in 2001, Robert has been published in many Redbooks® and trade publications with a focus on SQL, journaling, and communications. Robert can be reached at robert.andrews@us.ibm.com.

xiv

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:16 pm

7214pref.fm

Linda Swan is a software developer on the DB2 for i Query Optimization component. In addition, she has spent the past year working with DB2 Web Query for IBM i. Her current responsibilities include SQE query engine optimization technique and performance on IBM i. She can be reached at lmswan@us.ibm.com.

Tyler Even is a DB2 for i5/OS Technology Specialist in STG Lab Services System i group. He currently assists customers with application/database design and development using DB2 Web Query for IBM i, DB2 for IBM i, Java/VB, WebSphere®, and Lotus® Domino®. His current responsibilities include providing consulting services to IBM i customers with a special emphasis in DB2 Web Query for IBM i and Business Intelligence practices for IBM i. He can be reached at teven@us.ibm.com.

Thanks to the authors of the previous editions of this book. Authors of the first edition, Getting Started with DB2 Web Query for i, published in November 2007, were: Renee Mason Jackie Jansen Gene Cobb Thanks to the following people for their contributions to this project: Thomas Gray James Hansen Joanna Pohl-Miszczyk Jenifer Servais ITSO, Poughkeepsie Center Robert Andrews Michael Cain Fernando Echeveste Tyler Even Doug Mack Jarek Miszczyk Scott Moore Brian Muras Chuck Pence Sandy Ryan Rick Saltness Dan Toft

Preface

xv

7214pref.fm

Draft Document for Review January 3, 2010 1:16 pm

Eric Will IBM Rochester Wilfried Blankertz IBM Germany Julie Maw IBM UK Simona Pacchiarini Francesca Zoccheddu IBM Italy Larry Eiss Robert Fricano Gary Goldberg Pat Powers Terry Schwarz Information Builders Inc. Eric J. Songy EJS IT Consulting Rosemarie Pembleton Unique Industries

Become a published author
Join us for a two- to six-week residency program! Help write an IBM Redbook dealing with specific products or solutions, while getting hands-on experience with leading-edge technologies. You will have the opportunity to team with IBM technical professionals, Business Partners, and Clients. Your efforts will help increase product acceptance and customer satisfaction. As a bonus, you will develop a network of contacts in IBM development labs, and increase your productivity and marketability. Find out more about the residency program, browse the residency index, and apply online at: ibm.com/redbooks/residencies.html

Comments welcome
Your comments are important to us! We want our Redbooks to be as helpful as possible. Send us your comments about this book or other Redbooks in one of the following ways: Use the online Contact us review Redbooks form found at: ibm.com/redbooks

xvi

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:16 pm

7214pref.fm

Send your comments in an e-mail to: redbooks@us.ibm.com Mail your comments to: IBM Corporation, International Technical Support Organization Dept. HYTD Mail Station P099 2455 South Road Poughkeepsie, NY 12601-5400

Preface

xvii

7214pref.fm

Draft Document for Review January 3, 2010 1:16 pm

xviii

Getting Started with DB2 Web Query for i

Draft Document for Review December 17, 2009 2:29 pm

7214chang.fm

Summary of changes
This section describes the technical changes made in this edition of the book and in previous editions. This edition may also include minor corrections and editorial changes that are not identified. Summary of Changes for SG24-7214-01 for Getting Started with DB2 Web Query for i as created or updated on December 17, 2009.

December 2009, Second Edition
This revision reflects the addition, deletion, or modification of new and changed information described below.

New information
Spread Sheet Client Report Broker Adapter for Microsoft SQL Server Software Development Kit

Changed information
Updated information to latest release of products More examples have been added

© Copyright IBM Corp. 2009. All rights reserved.

xix

7214chang.fm

Draft Document for Review December 17, 2009 2:29 pm

xx

Getting Started with DB2 Web Query for i

Draft Document for Review December 17, 2009 2:29 pm

7214p01.fm

Part 1

Part

1

Background, installation, and setup
In this part, we introduce DB2 Web Query and provide guidance on how to install DB2 Web Query. We also introduce and provide background on IBM DB2 Web Query for System i. In addition, we provide installation and setup instructions for the product. This part includes the following chapters: Chapter 1, “Product architecture and overview” on page 3 Chapter 2, “Installation and server operations” on page 17 Chapter 3, “DB2 Web Query fundamentals” on page 25

© Copyright IBM Corp. 2009. All rights reserved.

1

7214p01.fm

Draft Document for Review December 17, 2009 2:29 pm

2

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:16 pm

7214ch01.fm

1

Chapter 1.

Product architecture and overview
Today’s information overload requires companies to analyze data quickly and easily in formats that suit the needs of different types of users. Executives want quick access to track key performance indicators; financial analysts want to analyze corporate performance to evaluate profitability or meet compliance guidelines; business managers need up-to-the-minute sales and inventory information to ensure customer demand and sales quotas can be met. The information needs to be delivered quickly and easily, with robust security in place, and distributed to a multitude of different client technologies, including browsers and spreadsheets, or integrated into line-of-business (LOB) applications. In this chapter, we introduce IBM DB2 Web Query for i (DB2 Web Query). This comprehensive Java-based business intelligence tool provides graphical, Web-based query and report writing functions. We include the following key topics in this chapter: A history of the Query/400 product including its current limitations An overview of DB2 Web Query including how it addresses the limitations of Query/400 DB2 Web Query architecture DB2 Web Query product positioning

© Copyright IBM Corp. 2009. All rights reserved.

3

7214ch01.fm

Draft Document for Review January 3, 2010 1:16 pm

1.1 Query/400: A product history
When the AS/400 was first released in June of 1988, one of the optional licensed programs was the Query/400 product, 5722-QU1. This product was used by midrange programmers, administrators, and users to retrieve, format, and analyze information from AS/400 database files to produce reports. The tool was widely popular within the AS/400 community due to its compact design, intuitive interface, and robust functionality. Users created custom reports by specifying the files, record selection criteria, fields to sort and group by, and column totals from a limited number of simple panels. The reports could be written directly to a panel, to a spooled file for printing, or to another database file for further processing. Then the definition could be saved to a permanent AS/400 system object (object type *QRYDFN), so that the report could be shared with other users and run again later. With a proper knowledge of the database, reports could be generated in minutes. The licensed program has since been renamed to IBM Query for System i and is still available, supported, and widely used on the System i platform today. However useful Query/400 has been to users in the past, it have several major shortcomings: Lack of a graphical interface Recently, significant emphasis was given to “modernize” System i applications. This refers to providing a more modern (graphical) interface for tools, applications, and any generated output. Many reporting tools available today have a Web browser or rich client-based interface. They also provide the ability to generate the reports in a variety of graphical formats such as PDF, HTML, XML, and Microsoft® Excel® spreadsheets. Query/400 does not support any of these interfaces. Lack of support for non-DB2 for i5/OS databases Query/400 can only access information that is stored in DB2 for i5/OS. If you require your Query/400 reports to include information from other databases, such as Oracle® or SQL Server®, then you must import these tables into DB2 for i5/OS. This method is simply not practical if you have large amounts of data that is dynamic in nature. Limited ability to view the data in a different way or further dissect the data and drill down Once run, the Query/400 output is static in nature and cannot be easily manipulated for further dissection and analysis. If you want to look at the data in a different way, such as to resort the list by a different column, you must create and run additional reports. Further, the ability to select a particular element in the report and drill down for more information and analysis simply does not exist. Again you would have to run another report to obtain this information. All this results in analysis that is disruptive, lacks flow and fluidity, and is time consuming in nature. It also places a strain on an IT department that is continually writing various versions of reports to satisfy user requirements. Not a pure SQL interface Query/400 is a proprietary interface and does not use the industry standard Structured Query Language (SQL) when accessing database objects. This limitation places restrictions on the functionality of the reports that can be created. New SQL functions and features that are introduced with each release cannot be directly or easily incorporated into Query/400 reports. Not strategic IBM has clearly stated that SQL is the strategic database interface for both creating and accessing database objects. Since Query/400 is not an SQL interface, IBM will not invest in this technology in the future, and therefore the product will not address any of the previously listed deficiencies.

4

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:16 pm

7214ch01.fm

Does not use the new SQL Query Engine (SQE) SQE was introduced in V5R2 of i5/OS and offers algorithms and features that give it distinct advantages over its predecessor, the Classic Query Engine (CQE). SQE is the strategic database engine, thus will receive all future enhancements. Although CQE will still be supported and maintained, IBM will not incorporate any new features into this engine. Only pure SQL requests are processed by the new engine. Because Query/400 is not an SQL interface, its query requests must be handled by the older CQE technology. For more information about SQE including its advantages over CQE, see the Preparing for and Tuning the SQL Query Engine on DB2 for i5/OS, SG24-6598. Over the years, thousands or perhaps millions of custom reports have been created using IBM Query for System i (also known as Query/400). As a result, businesses have a significant amount of investment contained throughout their systems in the query objects. Because so much has been invested in these objects, System i businesses need a way to leverage or repurpose them using a more modern reporting tool.

1.2 Introduction to DB2 Web Query for i
In April 2007, IBM and Information Builders Incorporated announced a product alliance. The new product, called IBM DB2 Web Query for i (DB2 Web Query), is the IBM strategic replacement product for Query/400. Like Query/400, it provides reporting capabilities against DB2 for i5/OS data. It also offers features that address the Query/400 limitations; it includes a graphical interface, modernized report formats, SQL access methods, and more. It can also run existing Query/400 reports, thus protecting the company’s valuable investment in those system objects. The DB2 Web Query product is available from IBM under licensed program 5733-QU2. Customers who have a license for Query/400, 5722-QU1, and are current on their software maintenance, are automatically entitled to the base license for 5733-QU2. Customers will be provided with a license for a limited number of named users based on software tier, unlike Query/400, which was licensed for unlimited users. Query/400 and DB2 Web Query: In an attempt to reduce the naming ambiguity, throughout this book, the product Query for System i will be referred to as Query/400 and the new product IBM DB2 Web Query for i will be referred to as DB2 Web Query. As the Web Query family progresses, new features are being released. Some of these features came out in release R110 while others were first introduced in release R111. Furthermore, other features have been made available via PTFs to R111. In this Redbook we will cover several of these new features. However, all the core technologies are there in R110 and much of this Redbook applies. In order to make sure you have Web Query at a level that you could get all of the features mentioned in this Redbook, please make sure you have R111 of Web Query with at least Group PTF Level 4.

1.3 Synonyms
DB2 Web Query employs a data description language (DDL) that describes the necessary data elements for many types of data sources, including relational structures. Using this language, DB2 Web Query can describe i5/OS tables (physical files) or views (logical files) that have been established within the relational database system on the System i platform.

Chapter 1. Product architecture and overview

5

However. including imported Query/400 queries. 1. They both refer to the DB2 Web Query data abstraction layer. Metadata and synonyms: The terms metadata and synonyms are used interchangeably throughout this book. DB2 Web Query creates a styled report that you can deploy on the Web without the necessity of learning the complexities of any reporting language. This HTML-based graphical tool allows you to create new queries or modify existing ones. We discuss the features that are supported by each of these options in the following sections.7214ch01. and display the report in your browser or another desktop application. DB2 Web Query generates HTML and displays the query results to the browser. Graph Assistant: Easy report graph generation Graph Assistant is an HTML-based tool that guides you step by step through the creation of a graph. This provides a modernized interface for running both existing queries and the report output. 6 Getting Started with DB2 Web Query for i .4 DB2 Web Query features Licensed program 5733-QU2 has a base product and additional product components. You can select a data source. you can direct your DB2 Web Query report output to the traditional spooled file and database file formats. Report Assistant: Web-based query and reporting of data stored in DB2 for i5/OS Included in DB2 Web Query is a component known as Report Assistant. 2010 1:16 pm This view of the data is a layer of abstraction that is used by DB2 Web Query for reporting and is known as synonyms or metadata. 1. Query/400 report modernization DB2 Web Query provides built-in adapters to import existing *QRYDFN objects without requiring any changes to those objects. This interface provides a graphical environment without the requirement of installing additional desktop software or plug-ins on user PCs. When you use Report Assistant. we highlight some of the main features of DB2 Web Query that are available with the base product of 5733-QU2: Browser-based interface A Web browser is the interface for both DB2 Web Query developers and those users who will run the reports. After the appropriate metadata is created from the import process. Delivery of output content in various modernized formats for Web browsers and wireless devices By default.fm Draft Document for Review January 3. the queries can be invoked from a browser interface and results displayed to the browser.4. You can learn more about metadata in “Creating metadata” on page 47. The following list shows the more commonly used formats that are available: – – – – Excel (97 and 2000) PDF XML PostScript® In addition.1 Base features In the following list. specify any sorting or grouping information. you can optionally specify other output formats. The Graph Assistant enables you to create and style your graphs.

Users can interact with their data. responds. drill-down and font customization to enhance the visualization of DB2 data Federated DB2 for i5/OS data access Customers with multiple System i machines or i5/OS partitions will value the federated query capabilities of DB2 Web Query. and performs like a Microsoft Windows®-based facility. optional features (also known as add-ons) are available to enhance the product’s functionality. 2010 1:16 pm 7214ch01. pivot rows and columns.1. “Data adapters” on page 13. refer to 1. backup. Runs natively on the System i platform Each server side component of the DB2 Web Query solution runs natively on the System i platform. enhances reports with extensive data-analysis functionality. ranking. This tool enables you to create output and page layout formats. and gives users the ability to dynamically interact with the data. and maintain.2 Optional features available from IBM In addition to the base product. This integrated environment equates to a more simplified environment. see 2. graphs. Developer Workbench: Rich client for building customized business intelligence applications DB2 Web Query Developer Workbench is an add-on component that provides a rich client development environment. OLAP enablement of a report allows users to drill down to finer levels of detail. there are fewer servers and operating systems to set up.5.fm Power Painter: What You See Is What You Get (WYSIWYG) report building Power Painter is a Web layout and report creation tool that is built by using Asynchronous JavaScript™ and XML (AJAX) technology. It combines reporting. The framework makes Power Painter a thin-client tool that looks. color coding. and page layout design in a single tool. Product architecture and overview 7 . Chapter 1. “Installation and setup” on page 18. secure.4. Ability to use matrix reporting. visualize their numeric fields.Draft Document for Review January 3. This satisfies a broad range of analytical needs. The following features are included in the list of add-ons: Enablement of existing reports to use Online Analytical Processing (OLAP) or multi-dimensional functionality The DB2 Web Query OLAP module allows slicing and dicing of data in an almost unlimited number of ways. Three adapters are provided with the base product: – DB2 CLI – DB2 Heritage files – Query/400 For more information about each of these adapters. Add-ons are available from IBM for an additional charge. 1. For more information about the base component of 5733-QU2. Data adapters Data adapters manage the communication between DB2 Web Query and the DB2 for i5/OS database through the use of SQL statements or other data access methods.5. administer. This feature provides the ability to develop a single report against multiple DB2 for i5/OS databases. and much more.

To help with this.7214ch01.html Additional named user licenses If you need more named users than the base option provides or you need more than you are currently licensed for. and refer to the following Web address: http://www. The following list includes reasons to consider such an upgrade: – Dimension tool • • • • Defines hierarchies to be stored in the metadata Is a prerequisite for OLAP module Includes meaningful field names Includes multilingual titles – Interface to easily manipulate metadata and customize synonyms – SQL Wizard that allows the developer to type or copy and paste SQL statements directly into the tool – HTML Composer tool The powerful HTM Layout Painter tool allows you to combine reports. you can purchase additional licenses. self-contained HTML file. 2010 1:16 pm While you do not need Developer Workbench to create DB2 Web Query reports. Run Time User Enablement For environments that have a large number of report consumers. It provides a WYSIWYG design environment to help you create professional looking layouts that require more advanced components such as custom HTML. there are compelling reasons to consider using it as your report development tool. graphs. For complete details on this offering. – Advanced programmer tools including: • • • • Data profiling Impact analysis Ability to change field types (including integer or alpha to recognized date fields) Automatic date decomposition Active Reports: Offline reporting capability Many mobile workers require access to important information that is stored in their analytic reports while disconnected from the Internet. refer to Chapter 8. such users can take the power of business intelligence with them wherever they go. With DB2 Web Query Active Reports.ibm. please review the White Paper at: http://www-03. and other elements together in a single HTML document or layout. we have developed a second licensing model. This model allows for essentially an unlimited number of report consumers. With this 8 Getting Started with DB2 Web Query for i . “Active Reports” on page 229. HTML template files. it still requires the users to go into the Web Query product to generate the output. compared to report authors.com/products/webfocus/portable_analytics.fm Draft Document for Review January 3. By combining data and interactive controls into a single. For more details. the standard named user licensing model may put Web Query out of reach.com/systems/resources/systems_i_software_db2_pdf_DB2_Web_Que ry_Run_Time_User_Enablement. For more information about Active Reports. with absolutely no software required. Active Reports delivers analytic capabilities in a completely portable and disconnected environment.pdf Spreadsheet Client While the base product has the ability to generate Microsoft Excel spreadsheets. and cascading style sheets (CSS).informationbuilders. contact your IBM representative.

Report Broker uses an Intelligent Bursting technology to break a single report into pieces. If you are a report author. Within a single spreadsheet. Product architecture and overview 9 . allow for the creation of dashboards right in Excel. break it into pieces based on burst values. This way if inventory runs low. With the reports created. This. By saving the report definition. such as SugarCRM. Table 1-1 Feature offering matrix Feature Base named user licenses Web browser interface Synonym creation Base offering X X X IBM add-on offering Chapter 1. DB2 Web Query can integrate data stored on Microsoft SQL Server. or even stored on the server. Just because the data is outside of the System i does not mean that it is out of reach of Web Query. users simply access the power of Web Query from within Excel. With this additional feature. to pass parameters into the report. like an HTML Launch Page. Reports can be based solely on SQL Server data or mixed in and joined to data on your System i.3 Companion products available from IBM In addition to the base product and its option features. you can get an inventory-wide report to show you the overall status of your company. they can be set to even automatically update the data on a set schedule. instead of generic warning. 2010 1:16 pm 7214ch01. and send the data only to those that need to see. Take a single Regional Sales report and send the complete item to the management team and only each regions data to the regional sales managers! Web Query Software Development Kit (5733-QU4) provides a set of web services that allow you to completely integrate the power of Web Query into your own applications. you can tie Report Broker into your program logic. IBM also offers two companion products to DB2 Web Query (5733-QU2). There is no need to go to the web browser. The output is then placed inside the spreadsheet. Adapter for Microsoft SQL Server While most of your data should be stored on the IBM i. This allows reports and graphs to be sent to email.4. you can use the Structured Ad-hoc Forms (SAF) method. Use the SDK pull Web Query into existing web-based or PC applications. Report Broker (5733-QU3) allows for automatic report and graph distribution. we can take a single report. this allows the reports to be refreshed and sent to other users. With Intelligent Bursting. Use it in your own application or many popular open source tools.Draft Document for Review January 3. While in Excel. If you are simply a report consumer.fm additional feature. Why learn two different reporting tools when Web Query can use that remote data source in an environment you will be very familiar with by the end of this Redbook! 1. Why design several different reports just for various regions or units. This provides the user a HTML page. you can have multiple reports saved. along with the powerful template capabilities of Excel 2007. two modes of operation are possible. Use Table 1-1 as a quick reference for determining which features are part of which offering. In addition to distribution on a set schedule. you can access Report Assistant within Excel to allow for the creation of reports that are put into your spreadsheet. printers. we do realize that some applications require data to be stored in a Microsoft SQL Server 2000 or 2005.

2010 1:16 pm Feature Report Assistant Graph Assistant Power Painter Modernized output (HTML. XLS. PDF. and so on) Query/400 adapter DB2 Heritage File adapter (multi-member or multi-format files) DB2 CLI adapter (System i tables.7214ch01. views) DB2 for i5/OS cross-system join OLAP Developer Workbench Active Reports Additional named user licenses Report Broker Web Query Spreadsheet Client Run Time User Enablement Adapter for Microsoft SQL Server Base offering X X X X X X X X IBM add-on offering X X X X X X X X 10 Getting Started with DB2 Web Query for i . physical files.fm Draft Document for Review January 3.

RPG. Chapter 1.NET.fm 1. VB.Draft Document for Review January 3.5 Architecture Although DB2 Web Query runs natively on the System i platform. C#. it is comprised of multiple application tiers that service different components. The overall architecture contains each of the following components: HTTP clients Web tier – Application server – Web server Reporting Server Data adapters Relational Database Management System (RDBMS) data DB2 for i5/OS is the integrated database for the System i platform. 2010 1:16 pm 7214ch01. The following actions describe the life cycle of a typical DB2 Web Query request: 1. it is helpful to understand the end-to-end process and how a report request flows through the architecture. Browser Client IBM System i HTTP Reporting Server IBM HTTP server Powered by Apache Applet TCP Synonyms i5/OS Integrated Web Application Server Servlet container HTTP JSP Servlet TCP DB2 CLI Data adapters DB Heritage Files Query/400 Microsoft SQL Server Developer Workbench Client Application Client QSQSRVR jobs IFS Application directories (domains and reports repository) Report Broker Distribution Server HTTP SOAP / XML Report Broker Repository DB2 for i5/OS Microsoft Excel as Client Excel Add -in Prepackaged WSDL files Windows Server Application developed using Web service language: C++. JAVA. Other source databases can be used with the installation of the appropriate add-on adapters that are discussed earlier in this chapter. Product architecture and overview 11 . COBOL Microsoft SQL Server Web based applications containing DB2 Web Query content Figure 1-1 DB2 Web Query base architecture To better understand the architecture. Figure 1-1 shows the overall architecture of the DB2 Web Query system. A user requests a report for execution from a Web browser.

5. The data adapter generates the appropriate database request and submits the request to the DB2 for i5/OS database engine. formats the report. 6. JavaServer™ Pages (JSPs) and connectors Does not require a full J2EE application server Supports servlets Standardizes deployment schemes using archives or packages 12 Getting Started with DB2 Web Query for i . CGI.2 Web server Web servers generally serve as the static content repository and handle HTML. The Web server content for DB2 Web Query is grouped into contexts (aliases). These are grouped together in subdirectories and stored in the i5/OS integrated file system under the qibm/proddata/webquery/ibi/webfocus76 directory. processes the parameters. The Web server receives the request. The DB2 Web Query application server has the following attributes: Is a J2EE™ compliant Web application Runs on a servlet container. and routes it to the Reporting Server via the DB2 Web Query servlet. and other traditional Web content and processing. The following Web browsers are supported: Internet Explorer® (IE) version 6.fm Draft Document for Review January 3.5. 2010 1:16 pm 2. It handles requests from Web clients that require Java and non-traditional processing and provides middleware services such as security and state maintenance. The browser clients communicate via HTTP to the application server. 1. The IBM HTTP Server is used to fulfill this role for the DB2 Web Query product.5.7214ch01. The Web server delivers the report to the user’s Web browser for display. a Java-based container that serves servlets.5 or later 1.1 Web browser clients Both DB2 Web Query developers and users use a Web browser as the interface to the product.0 or later Mozilla Firefox version 1. The Reporting Server processes the request and passes it to the appropriate data adapter. GIF. Servlet containers (also referred to as servlet engines). 5. Under this directory is webquery_html. 4. 3.3 Application server An application server is a component-based product that resides in the middle-tier of a server-centric architecture. The Reporting Server receives the result set from the database. and returns the formatted report to the Web server via the DB2 Web Query servlet. scripts and style sheets Published forms and launch pages 1. DB2 Web Query runs on the i5/OS Integrated Web Application Server and uses the servlet container component to process these client requests. the context subdirectory that contains the following items: Common templates and forms Common images.

This command does not take advantage of the new enhancements to the DB2 optimizer and uses the Classic Query Engine (CQE) under the covers. The adapter that you choose to create your metadata or synonym is transparent to the users who will create reports. This adapter is also used for object types of alias. This is the recommended adapter for use by DB2 Web Query. Product architecture and overview 13 . The DB2 CLI adapter generates SQL that takes full advantage of the latest DB2 enhancements that are found in the SQL Query Engine (SQE).fm In some cases. Choose this adapter when you want to create metadata on an already existing Query/400 query. The format of the request depends on the adapter that is used: The DB2 CLI adapter generates appropriate SQL statements to submit to the DB2 for i5/OS database engine. The QRYDFN object must exist on the System i platform. processing the business logic. groups multiple applications into Web Application Bundle (WAB) files Applications are grouped into the WAB file named webfocus76. It is comprised of the following components: Reporting Engine of DB2 Web Query product Data adapters repository Metadata or synonym repository 1. The Query/400 adapter retrieves the associated Query/400 query. Select this adapter if you want to write a report on a single member physical file. DB2 Web Query comes with three different adapters. The report can include an SQL table or a data description specifications (DDS)-created physical file. and generating the fully styled output. The DB2 Heritage File adapter generates the appropriate OPNQRYF command to handle reports that are based on data in a file that has multiple members or multiple record formats.wab. This adapter sends the RUNQRY command to the server.5 Data adapters An adapter is a program that enables DB2 Web Query to access a data source. and materialized query tables (MQTs).5.5. This WAB file is served under the context root of /ibi_apps and contains the following components: – DB2 Web Query servlet • • – – – – – – DB2 Web Query API Managed Reporting API Communicates with the MR Repository (basedir) DB2 Web Query home page controller and JSPs DB2 Web Query administration console DB2 Web Query and Managed Reporting drivers Communication Drivers to DB2 Web Query server Custom DB2 Web Query exit (plug-in) Custom servlet filter (plug-in) 1.4 Reporting Server The DB2 Web Query Reporting Server is a C-based application that resides on the System i platform and is responsible for managing data access. Chapter 1. stored procedures. Table 1-2 on page 14 summarizes the adapters and how they correspond to the data types. 2010 1:16 pm 7214ch01. which also uses the older CQE.Draft Document for Review January 3. Data adapters are responsible for generating the appropriate request to submit to the database engine.

or MQT Multiple member file. Once created. 2010 1:16 pm Table 1-2 Data adapters Adapter DB2 CLI DB2 Heritage File Query/400 Data type Single member physical file. we offer the optional Adapter for Microsoft SQL Server. This feature is available as a chargeable add-on to the base 5733-QU2 product. Metadata is created the same way as in DB2. you can connect to Microsoft SQL 2000 or 2005 servers. you can create reports solely against the SQL Server data or even join tables between SQL Server and DB2 on i.fm Draft Document for Review January 3. Learn one set of tools and use them for all of your reporting needs! 14 Getting Started with DB2 Web Query for i . stored procedure. alias. With the Microsoft SQL Server adapter. multi-record format files QRYDFN object Command sent to System i5® machine CLI API OPNQRYF RUNQRY In addition to the three adapters that are included in the base Web Query product.7214ch01.

the base product is all that you need.nsf/Request_for_Design_Change?OpenFor m Chapter 1. to e-mail (one of the more common destinations). Delivery destinations include a database archive (called a Report Library). the Report Broker product gives you the ability to automatically deliver reports to your users. let us know! You can voice your opinion and ideas to us via the web. This add-on component can intelligently burst the pages of a single report to the appropriate people. Because DB2 Web Query is comprehensive and can access all data in a company. Product architecture and overview 15 . or even a change in the weather. 2010 1:16 pm 7214ch01. It does not require a data warehouse or cubing technology.8 Request for changes on Web Query The IBM DB2 Web Query team is always looking for ways to improve the product. You can use the standard Request for Design change form. the Developer Workbench client communicates in HTTP to the DB2 Web Query application server. 1. but if that is the desired business intelligence infrastructure. Developer Workbench is an optional feature of DB2 Web Query.You can use it for management within your organization to provide the following types of reports to keep you updated on the general health of your business: Dashboards Scorecards Key performance indicators (KPI) Drill downs Operational reports In addition.7 DB2 Web Query product positioning The base version of the DB2 Web Query product is intended to serve as the strategic replacement to Query/400.fm 1. it integrates with that design with ease. it is the logical choice as the standard for business intelligence and reporting for many companies. or your requirements are for a robust query and reporting tool on the System i platform.com/r_dir/ReqDesChange. such as a new transaction. For Web Query. Similar to the browser client.6 DB2 Web Query Developer Workbench Developer Workbench serves as the “thick” client component of DB2 Web Query that is used primarily for advanced development purposes. This product fills user reporting requirements from parameterized and ad hoc reporting. to analytical (multidimensional) slicing and dicing. mobile devices. Consequently. While the new Web-based product is ideal for the mid-market. If you have a suggestion for a new feature or would like a change to an existing feature. If you are using Query/400 today as your primary reporting tool.Draft Document for Review January 3.ibm. be sure to select the DB2 Web Query option from the problem area drop down. the rise of fall of a stock price to a certain level. the upgrade path (available through the various add-on components) allows DB2 Web Query to be well positioned to support such large enterprise needs as well. it offers the foundation to support large enterprise requirements as well. Delivery can be based on a schedule or technology event. 1. The address to get to the web form is: https://www-912. This form can be used to requests changes to all IBM products around IBM i. It is the standard integrated development environment (IDE) for DB2 Web Query technology. if you have requirements for more advanced business intelligence capabilities. and to a printer.

7214ch01.fm Draft Document for Review January 3. 2010 1:16 pm 16 Getting Started with DB2 Web Query for i .

ibm. we discuss other system objects that are created upon installation of DB2 Web Query. In addition. Note: For the most current and complete information about the installation instructions. see the IBM DB2 Web Query for i Install Instructions on the Web at: http://www-03. We outline the PC and System i prerequisites for installing DB2 Web Query. we explain the installation of DB2 Web Query. We also describe which i5/OS system jobs will run and their functions in DB2 Web Query.fm 2 Chapter 2. 5733-QU2. 2009.com/systems/i/software/db2/pdf/DB2_Web_Query_Install. 17 .pdf © Copyright IBM Corp. Installation and server operations In this chapter. 2009 2:29 pm 7214ch02. All rights reserved. using the RSTLICPGM command.Draft Document for Review December 17.

which replaces 5722-QU1 (Query/400). you will need to follow the up to date instructions on the web site listed above.ibm. Install pre-requisite PTFs and PTF Groups. While the exact steps will be documented on the web. a new Group PTF for Web Query will be release about every three months. Install the DB2 Web Query product 4. If you run into a problem and call support. Query/400. they are going to ask that you are at the most current Group PTF for Web Query. Please refer to the Info APARs about updated Group PTFs and try to stay as current as possible. as an independent product. You can find this information in Informational APAR. DB2 Web Query includes the existing Query/400 product as well as the new offering. In order to continue using Query/400. if missing 2. if missing 3.fm Draft Document for Review December 17. product number 5722-QU1. the basic flow of the process consists of: 1. Install PTF Group for DB2 Web Query 5.7214ch02.1. As noted. Install any add-ons purchased and their PTFs 6. Install pre-requisite programs.1 Installation and setup The licensed program product number for DB2 Web Query for i is 5733-QU2. you will need to obtain a license key for 5722QU1 via the IBM License Assistance Center. click the Getting Started tab. upgrade instructions. Configure Language if not running in English It is important that you follow all the steps as documented in the Installation Instructions and Info APARs. 2. the following integrated file system directories are created: /QIBM/PRODDATA/WEBQUERY/IBI /QIBM/USERDATA/WEBQUERY/IBI Table 2-1 on page 19 shows the system objects that are created. 18 Getting Started with DB2 Web Query for i . 2009 2:29 pm 2. i5/OS system objects Upon installing 5733-QU2. The two products can successfully operate concurrently against the same tables and libraries. The functionality will reside under 5733-QU2 with DB2 Web Query. which is available on the Web at: http://www. you must obtain the most current information about the prerequisites and required program temporary fixes (PTFs).com/systems/i/db2/webquery To install DB2 Web Query. Once on the Web Query home page.1 Installing DB2 Web Query Important: Before you start the installation. Here you will find links to the install instructions. and Info APARS. will be withdrawn from marketing. You can continue to create and run Query/400 reports and slowly migrate to DB2 Web Query if you choose.

3 License keys After you install DB2 Web Query. In order to add or remove licenses from user profiles. Installation and server operations 19 . It also has the rights to create reports in all domains and folders on the system. There are multiple types of licenses available. However.fm Table 2-1 System objects Object name Object type *LIB *USRPRF *USRPRF *USRPRF *AUTL *JOBD MSGQ QWEBQRY76 QSYS/QWEBQRYADM QSYS/MRADMIN QSYS/MDUNTITLED QSYS/QWEBQRY QWEBQRY76/QWEBQRYJOB QUSRSYS/QWEBQRYADM These are DB2 Web Query-related user profiles: QWEBQRYADM: This profile has functionality on the server side and has authority to start and stop the Reporting Server. you need to work through your normal product ordering channels (for example. you can view the currently licensed users by running: WRKLICINF PRDID(5733QU2) Then take option 8 next to the feature 5050. license keys are required to continue using both the base product and the add-on components. every user must be pre-authorized. 2. 2009 2:29 pm 7214ch02. after the grace period expires. you have access to all the features that are provided in the base product as well as all of the IBM add-on components. For each user that will use the product.1. The profile is automatically created. In addition to the Admin tool.2 Authorizing and verifying users The users must be licensed to use DB2 Web Query. MRADMIN: This group profile has the authority to create domains in DB2 Web Query. 2. The system serial number is required to generate your specific license keys. However. you are allowed a grace period in which to try the product. use the WRKWEBQRY Administration tool. Chapter 2.2. For details on the various licenses and the use of the Administration tool. “Licensing DB2 Web Query users” on page 26 You can also use the Administration tool to view who is currently licensed. MDUNTITLED: This group profile gives users the authority to create reports in the default common domain.1.Draft Document for Review December 17. please see 3. you need to allocate them a license. During this grace period. a System i business partner). To obtain your DB2 Web Query license keys.

2. use the ADDLICKEY command. update the interface of the program to match the language selected. You can do this at any time.fm Draft Document for Review December 17.2 Requirements In this section. To use this feature. you only need a browser. Therefore. we cover the PC and System i minimum requirements to install and run DB2 Web Query.redbooks. If the user has the Developer Workbench tool and has set multiple field names in each language.0 or later Firefox 1. 2. 2009 2:29 pm Each license key is used to activate either the base product feature (5050) or one of the add on features. but we are making this sample database available to you. the level of translation depends on the data source and the configuration of the metadata. This is included in the base product.1. the data itself will not be translated.0 (supported) If you are unsure about the version of Internet Explorer that you are using. the Dynamic Language Switching option is for you. Download the save file from the site below and upload it to your server. 20 Getting Started with DB2 Web Query for i . Note: You do not have to wait for the grace period to expire before you enter your license keys. The browser requirements are: Internet Explorer 6. then it will show the appropriate header to match the language. To enter your license keys and activate the specific features. This feature will.ibm. However.4 Dynamic Language Switch If you are running a system that may need to be viewed in multiple languages.1 PC requirements No client is required to be installed on your PC to enable DB2 Web Query.5 (certified). This allows you to follow along screen shot by screen shot to see exactly what you get in the book.ibm. please follow the instructions in the installation document on the Getting Started tab of the DB2 Web Query home page at: http://www. be default.7214ch02. version 2. we will be using a sample database called the Century database. It allows you to set a list of languages that user can select from at log in time.1. This database is available as a save file for download from the IBM Redbook Additional Material section for this book. 2. Do a restore library of QWQCENT and you are set to follow along! ftp://www. Note the version number.com/systems/i/db2/webquery 2. You can use your own data if you like.5 Sample Database Throughout this Redbook. open the browser and select Help → About Internet Explorer.com/redbooks/SG247214 2.

and online analytical processing (OLAP). you have the option to install it with Developer Workbench. display of 1027x768 recommended 512 MB of RAM 500 MB free hard disk space Software requirements Verify that your Windows machine meets the Developer Workbench software requirements: Windows 2000.2. Acrobat Reader 6 and 7 are certified to view PDF reports generated by Developer Workbench.3 Developer Workbench requirements Although Developer Workbench client is not required for DB2 Web Query report development and execution. in general. Installation and server operations 21 . 2. 2009 2:29 pm 7214ch02. graph generation. If possible. you might still find that it provides additional development features that make it worthwhile. If it is not present on your machine. you must allow Developer Workbench to install the SDK. If Java SDK 1. Note: You must be an administrator to the Windows machine to run the Developer Workbench installation. If you choose to install it on your PC.0 and later. or 2003 Server and Professional Editions Windows 2000 must have Service Pack 2 or later Internet Explorer 6 and later Internet Explorer components are required for Developer Workbench.5.0_09 is provided for use with Developer Workbench. Adobe® Acrobat® Reader 6.fm In regard to PC memory requirements.Draft Document for Review December 17.2 System i requirements Your System i environment must meet the following requirements: V5R4 of i5/OS or higher is required. 2. XP. use the following hardware and software requirements.2. Hardware requirements Verify that your Windows machine meets the Developer Workbench hardware requirements: Pentium® 3 or later at 600 MHz or later VGA or later resolution graphics card. Chapter 2. upgrade to the most recent version of Internet Explorer.4.1 or later is not installed on your machine. queries usually run best on PCs that have 1 GB of RAM or more. Provided third-party component The third-party component Java 2 SDK 1. A Java SDK is required for WebFOCUS features such as servlet connectivity.

4 DB2 Web Query server jobs Typically. CLI is a callable SQL programming interface that is available in DB2 on the IBM i operating system. 22 Getting Started with DB2 Web Query for i . TCP. They are referred to as “agents. 2009 2:29 pm 2. Web Query will not start. any user that is authorized to the commands via *ALLOBJ special authority or explicit authority is able to start or stop Web Query. and saves server traces. For more information about CLI. However. The job log will provide complete details on what was missing to allow you to correct this issue. EDAPTH: One job that helps with the workspace process and runs under the user profile QWEBQRYADM. the commands to work with Web Query are shipped as *PUBLIC *EXCLUDE. DB2 Web Query the interface that DB2 Web Query uses to access the DB2 for i database is the SQL call-level interface (CLI). When starting Web Query. one TSCOM3 job can service several users. For this reason. STRWEBQRY Use the STRTWEBQRY command to start all the jobs that are required to run Web Query.pdf The following jobs run on your server when the Reporting Server is running. EDAPLOG: One job that contains startup information and runs under the user profile QWEBQRYADM. TSCOM3: By default. you can use the Web Query Administration tool. In addition to using the CL commands to start and stop the server. four of these jobs are running.Be default. 2.3 Web Query Commands The base component of the licensed program provides multiple i5/OS commands to help with DB2 Web Query administrative tasks.com/infocenter/iseries/v5r4/topic/cli/rzadp.” and all run under the user profile QWEBQRYADM. JSCOM3C: One job that services Java processes and runs under the user profile QWEBQRYADM. turns off. The CLI is a subset of Open Database Connectivity (ODBC). If required products or PTFs are missing. The system job that processes CLI is QSQSRVR. One TSCOM3 job does not correspond to one user. TRCWEBQRY The TRCWEBQRY command turns on. CLI consists of application programming interfaces (APIs) that are used to connect to the server and start dynamic SQL statements. These jobs accept the request from the EDAPGWY job and translate the DB2 Web Query request into SQL. the design of these jobs contributes to the scalability of the product. All run under the user profile QWEBQRYADM.boulder. it performs a pre-requisite check.ibm.7214ch02. one each for HTTP. refer to System i Database DB2 UDB SQL call level interface (ODBC) on the Web at: http://publib. and Java. the start time of the job is the start time of the Reporting Server. For all jobs. These jobs receive incoming requests and hand off work to the TSCOM3 jobs.fm Draft Document for Review December 17. ENDWEBQRY Use the ENDWEBQRY command to end the Reporting Server. EDAPGWY: Three listener jobs.

QP0ZSPWP: Two jobs that run under user profile QWEBQRYADM. port 11337 is not used. However. At the time of publication. execution. you will see the local port column is ordered descending. Scroll down until you reach a local port of 11331 to see these connections. WQLWI7: This job is for integrated application server jobs. the user profile running the job is swapped to the user profile that initiated the DB2 Web Query report request. use F14 to display port numbers. Therefore. The WQLWI7 jobs will run in the QHTTPSVR subsystem. Four of these jobs should be running whenever DB2 Web Query is active (three run under the user profile QTMHHTTP. these jobs will run in the QSYS work subsystem. At this point. Chapter 2. As you scroll down. DB2 Web Query will be active on ports 11331 to 11339. When running. This job does the actual database work of optimization. ports 11336 and 11338 may not start until the first user hits the Web Query login page. Another way to look at the jobs is via their ports. By default these jobs run under the user profile QUSER but when DB2 Web Query report (based on a DB2 CLI synonym) is run.Draft Document for Review December 17. the other under profile QWEBQRYADM) QSQSRVR: This IBM i native prestart job handles SQL requests that are made over CLI. When first started. a CLI connect event occurs with one of these jobs. 2009 2:29 pm 7214ch02. With the exception of the WQLWI7 jobs. and returning the result. Once the display is up. In addition. the following jobs are started if you have the DB2 Web Query Report Broker product installed and running: STRBROKER: One job that runs under QWEBQRYADM and invokes QSHELL to run a script to start the Distribution Server. if you do not have that product installed. Port 11339 is used for DB2 Web Query Report Broker. You can look at active ports by using the NETSTAT command and taking option 3.fm HLISNK: One job which is an internal server process and runs under the user profile QWEBQRYADM. One job is the JVM™ and the other is the console window that the Distribution Server starts up. Installation and server operations 23 . it is possible to customize your system such that the QSQSRVR jobs run in a different subsystem. this port will not be active.

fm Draft Document for Review December 17.7214ch02. 2009 2:29 pm 24 Getting Started with DB2 Web Query for i .

25 . The report developer could be a DataBase Administrator (DBA) or someone who works closely with the DBA to gain access to the data that is needed to create the necessary reports to meet the needs of a target audience. alter and run reports within one or more specifically authorized domains. A developer can also create subfolders for partitioning reports within a domain. Marketing and Research.fm 3 Chapter 3.1 Types of DB2 Web Query users There are three types of DB2 Web Query users: an administrator. Human Resources. An Administrator can perform the tasks of a Developer or Basic user but does not need to. for example: Sales. It is through a domain that access to reports is secured. An administrator has access to all domains and the reports within those domains. You may choose to have your DB2 Web Query Administrator be someone whose sole purpose is to set up the report domains and control authorized access to develop or use reports within those domains. a developer or a basic user: Administrator tasks on page 31 Developer tasks on page 43 Basic user tasks on page 85 Each installed DB2 Web Query instance must designate at least one IBM i user as an administrator. or Executive Performance Indicator reports. the two different ways a user can be licensed to use the product. It is the administrator who creates report domains and subfolders used by those who develop reports. DB2 Web Query fundamentals In this chapter.Draft Document for Review January 3. Different domains are created to segregate your reports by topic or by target audience. A report Developer is someone who can create. All rights reserved. and the specific tasks performed by each user type. 2009. Both the role of the DBA and the report developer are covered under Developer tasks. 2010 1:16 pm 7214ch03. we introduce the basic steps needed to get started using DB2 Web Query. © Copyright IBM Corp. We will discuss the three types of DB2 Web Query users. 3.

influence the content of the report by selecting or providing various input values to a report but cannot actually alter the definition of the report. you can determine whether or not the Run Time User Enablement option is right for your organization. based on how the report is defined. Registered/named users User profiles are explicitly licensed to use the product. you may be authorized to run a report within a specific domain but if your login profile is denied access to the underlying table. For more information on domains. Although a DB2 Web Query user may be an administrator. “DB2 Web Query domains” on page 31. there are two different ways a user profile can be licensed to use the product. A basic user can. refer to section 3. Depending on the number of basic users you anticipate need access to reports.fm Draft Document for Review January 3. These are called registered or named users and each individual user profile consumes a license. 3. Regardless of which licensing option you decide to implement. all DB2 Web Query administrators and developers must be registered as named users of the product.5. stored procedure or Query/400 object. 2010 1:16 pm Finally. It is the group profile that becomes the named or registered user of the product. you must purchase and install 5733QU2 Option 4. These user profiles are called run time users. a report developer or a basic user as defined by the product. Since access to a report is secured by the domain. the Run Time User Enablement option. As a basic user. only in specifically authorized domains. the administrator will need to determine the number of explicit licenses of the product to acquire. a Basic user of reports is someone who is only allowed to run reports and again.2.2 Licensing DB2 Web Query users In addition to the three types of Web Query users. view.1. runtime users share a license through an associated group profile that is tied to a report domain. Consequently the number of licenses needed is dependent on the number of domains that are required in your reporting environment. Run time users Group profiles are explicitely licensed to use the product. Note: In order to register users as Run Time users. This is based on the number of report developers (each developer needs a license) and the number of report domains that allow a shared license for run time users.1 Comparing the licensing options As described previously. These group profiles are associated with a specific DB2 Web Query domain. the report will still not run 3. It is only a basic user who can access reports by logging in to DB2 Web Query and sharing a runtime user license that is allocated and registered to a group profile tied specifically to the DB2 Web Query domain. thus allowing more control over what a basic user 26 Getting Started with DB2 Web Query for i . User profiles that are members of these group profiles can then gain access to the product under the license umbrella of the group profile. the operating system's object level security rules are still enforced when it comes to actually accessing the data related to a report.7214ch03. each report topic could be its own domain. If the Run Time User Enablement option is chosen.

DB2 Web Query fundamentals 27 . regardless of the subfolder they are placed in. While this type of implementation would effectively provide an unlimited run time (basic) user environment.Draft Document for Review January 3. one for each domain. 2010 1:16 pm 7214ch03. in Figure 3-1 this would mean acquiring four additional user licenses for runtime users. Keep in mind that you if have in place object level security the unauthorized users can see the list of reports but they can not actually execute them.For example. The groups of reports could be organized in subfolders. it would not be as secure because all users would have access to all reports in the single domain.fm is exposed to. Such an environment would require only one additional license for runtime users. Chapter 3. Four Domains Figure 3-1 Example of DB2 Web Query environment with four domains Alternatively. you could choose to put all reports under a single domain. as shown in Figure 3-2.

follow the articles link on the DB2 Web Query Getting Started page. With Report Broker. DB2 Web Query user registration topics using the CL commands is covered.3 Registering named users Because DB2 Web Query requires the registration of users or group profiles (depending on the licensing option implemented). the scheduling and automated distribution product of the DB2 Web Query product suite. and therefore would not require and consume a user license. For more information. This type of “push” implementation means that there is an entire report user community that can have access to reports without consuming user licenses: because their reports are distributed to them via E-mail. the members of this user community would not require direct access to DB2 Web Query. see Chapter 15. a basic user could only access reports within 16 distinct domains. 3. 28 Getting Started with DB2 Web Query for i . You can use the Work with Web Query (WRKWEBQRY) utility (discussed further in the section “Work with Web Query (WRKWEBQRY) administration utility” on page 36) or you can register DB2 Web Query user profiles using the Add Web Query Licensed User (ADDWQLUSR) CL command. another licensing option to consider is DB2 Web Query Report Broker. considerations for how many licenses are needed and whether or not this licensing option is a good fit for your environment. “Report Broker” on page 393 licensed program product. In this section. and look for "DB2 Web Query Run Time User Enablement'.fm Draft Document for Review January 3. If the majority of your users are basic users that. two different methods are provided to help carry out these tasks. at most. For more information on the Run Time User Enablement option. This is an IBM i operating system restriction and it means that. 2010 1:16 pm One Domain Figure 3-2 Example of DB2 Web Query environment with one domain Note: The maximum number of group profiles that a user profile can be a member of is 16. reports and graphs can be scheduled to run in a batch mode and distributed to the target recipients via E-mail or printer.7214ch03.

issue the following command: ADDWQLUSR <userprofile> Taking this action will consume a user license.abc. you can register new users from the WRKWEBQRY utility discussed on page 36.1.acme.1 Adding a New User To register a DB2 Web Query user. This list contains all the user profiles or group profiles (if using Run Time User Enablement) that currently have a DB2 Web Query user license. Enter the following internal URL: http://mysystem. take the following steps: Note: In this example. Alternatively. 2010 1:16 pm 7214ch03.3.ACME. 3.Draft Document for Review January 3. As mentioned in 2. Chapter 3.this is the pre-configured port for DB2 Web Query. One of the many attributes of DB2 Web Query is that you do not need to install anything on your PC to use it.3. 3. the process of logging in is the same. you can use the WRKWEBQRY utility discussed on page 36 or you can enter the following command: WRKLICINF PRDID(5733QU2) Then select option 8. issue the following command: RMVWQLUSR <userprofile> Taking this action will free up a user license. DB2 Web Query supports Internet Explorer and Firefox. DB2 Web Query fundamentals 29 .2.ABC. Work with licensed users for feature 5050.2 Removing a DB2 Web Query registered User To remove a registered DB2 Web Query user.COM: 1. 3. You only need a web browser to create and run reports. To log into DB2 Web Query. the system name is MYSYSTEM. “PC requirements” on page 20. you can remove users from the WRKWEBQRY utility discussed on page36.4 Logging in Regardless of the type of DB2 Web Query user you are.fm 3.com:11331/webquery The port number in the URL is always 11331 .3 Displaying registered users To display the list of user profiles that are currently registered to DB2 Web Query. Alternatively.3.

2010 1:16 pm 2. Sign onto DB2 Web Query with the same user profile and password that you use to access the IBM i machine. Figure 3-4 DB2 Web Query signon page with Dynamic Language Selection Upon log in. For an explanation about domains. “DB2 Web Query domains” on 30 Getting Started with DB2 Web Query for i . This allows you to select the language of choice. See 2.1. you see only the domains and menu options that you are authorized to as shown in Figure 3-5.7214ch03. Figure 3-3 DB2 Web Query signon page If your DB2 Web Query instance was configured with Dynamic Language selection. refer to 3.fm Draft Document for Review January 3.5. your login will provide you with a Select Language pull down as illustrated in Figure 3.1. “Dynamic Language Switch” on page 20 on how to configure Dynamic Language selection. A Web page opens like the example shown in Figure 3-3.4.

the term domain refers to a graphical way to classify. and so on. Tip: Add your DB2 Web Query URL to your browser “Favorites”. separate. Attention: To perform the administrator tasks.5. For example. This administrator is the only one who is authorized to create new domains. The administrator is authorized to create and run reports in all domains. an administrator can create domains for Sales.5 Administrator tasks The main tasks for administrators are to create domains. Figure 3-5 DB2 Web Query home page 3. Marketing. If user profile OZZIE is to be the administrator. and secure your reports. the administrator must have a user profile and the group profile or supplemental profile for that user profile must be MRADMIN. If you do not see a domain that you think you should be authorized to. Chapter 3. DB2 Web Query fundamentals 31 . use the following CL command to assign it to the group profile MRADMIN: CHGUSRPRF USRPRF(OZZIE) GRPPRF(MRADMIN) If the user profile OZZIE already has a group profile.Draft Document for Review January 3. create subfolders within those domains. 2010 1:16 pm 7214ch03.fm page 31. then use the following command so that you do not to overwrite the current group profile: CHGUSRPRF USRPRF(OZZIE) SUPGRPPRF(MRADMIN) 3. and assign user authority.1 DB2 Web Query domains In the context of DB2 Web Query. contact your DB2 Web Query administrator. Human Resources.

You need to know what the Href is in order to assign user authority. We explain more about the eight-character rule in the following section.fm Draft Document for Review January 3. 2010 1:16 pm The first time you open your browser to DB2 Web Query. DB2 Web Query checks which IBM i groups the user belongs to. The padding characters are autogenerated. The Other Files folder contains files like style sheets and JPG files that you might want to import into your report. These eight characters are also known as the Href. you see only the default Common Domain folder. To view an Href for a domain. Figure 3-6 Common Domain folder Naming your domain It is good practice to initially name your domains with exactly eight characters. Users go into this folder to find the report they want to run. If the user belongs to a group named “MDhrefname”. “Assigning authority to users” on page 35.3.7214ch03. the user can be a developer in the domain with the 32 Getting Started with DB2 Web Query for i . the domain name is padded to complete the eight characters.5. Figure 3-7 Properties of a domain Reason for creating domains with exactly eight characters DB2 Web Query uses the Href. which is based on the domain name. Inside the Common Domain folder. If you create a domain that has less than eight characters. Developers that are authorized to this domain can create new reports in this folder. you see two other folders as shown in Figure 3-6: The Reports folder is where permanent report objects are displayed. as shown in Figure 3-7. to control user access to the domain. which is explained in 3. right-click the domain and select Properties.

Having a group profile of MUUNTITLED means that the profile is a valid user in the Common Domain (Href “untitled”) and is allowed to run reports there but not to create them. right-click your domain and select Properties in order to view what was autogenerated. Chapter 3. they must belong to the group MDUNTITLED. Then you can rename it to Month End Reports and your Href remains as the eight characters of “monthend”. Right-click Domains and select New Domain. If you are registered as a licensed user of DB2 Web Query. In fact. The other special prefix is that DB2 Web Query checks for MU. Tip: Avoid using blanks or special characters in domain names. or field names within DB2 Web Query. Table 3-1 Developer and basic user group profiles Domain name Month End Report Href name monthend Developer group profile MDMONTHEND Basic user group profile MUMONTHEND Creating a domain To create a domain: 1. Table 3-1 shows the Developer and Basic User group profiles for our example. The original eight characters remain as your Href name. like the one in Figure 3-8. 2010 1:16 pm 7214ch03. Log on to the DB2 Web Query home page as administrator. you can first create your domain as “monthend”. the Common Domain is the system default and is the one domain in which you do not require an MUhref to run reports. first create it with a meaningful name of exactly eight characters. if you want your domain to be “Month End Reports”. 3. folder names. For a user to be a developer in the Common Domain (Figure 3-7). Then rename your domain to a desired name that is greater than eight characters. Figure 3-8 New Domain window 4. 2. In the New Domain window that opens.Draft Document for Review January 3. then you are entitled to run reports in the Common Domain by default. DB2 Web Query fundamentals 33 .fm associated Href. If you want a domain name to be greater than eight characters. type your domain name and click Save. For example. which is a user profile that belongs to the MRADMIN group. If your domain name was shorter than eight characters.

you can then rename your domain by selecting the Properties menu option to give it a more descriptive name. In the Domain Properties window (Figure 3-9) that opens. Take the following steps to rename a domain: 1. Figure 3-9 Domain Properties window 3. a developer or user can recognize which subfolder contains the desired report. click OK. Right-click the existing domain and select Properties. Right-click Reports and select New Folder. In the New Folder window (Figure 3-10) that opens. To create a subfolder: 1. Note: Both administrators and developers (within the domain) are authorized to create new subfolders. type a preferred name over the name in the white box. you must create folders inside of those domains. in the Name field. You must use a subfolder to create and store reports. 2. Keep in mind that you cannot create reports directly in the Reports folder. 2. These subfolders further classify the types of reports within their domains. type the desired name for the new folder and click the Save button. 2010 1:16 pm Renaming a domain After creating your domain with a short name to facilitate a meaningful Href.7214ch03.5. 34 Getting Started with DB2 Web Query for i . After you edit the name. a basic user is not. When the domain is expanded.fm Draft Document for Review January 3.2 Creating subfolders After you create your domains.

DB2 Web Query fundamentals 35 . MDMONTHEND denotes the developer group profile for that domain and MUMONTHEND denotes the basic user group profile for that domain.3 Assigning authority to users As mentioned earlier in this section. one of the key tasks of a DB2 Web Query administrator is to authorize report developers and basic users to specific report domains. 3. Using MONTHEND as an example domain.5. Table 3-2 shows the three user types and the authority they have.fm Figure 3-10 New Folder window Now developers can create reports in the folder. Table 3-2 Authority of the different users Administrator Group Profile name Authority Create domain Create subfolder Create report Change report Run report Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes MRADMIN Developer MDMONTHEND Basic user MUMONTHEND A DB2 Web Query administrator has two approaches to authorize developers or basic users to DB2 Web Query: a manual approach or the use of the WRKWEBQRY administration utility. Chapter 3. Manual steps for authorizing users to a domain The following are the manual step an administrator would take after creating a new domain to authorize both a developer and a basic user to the domain.Draft Document for Review January 3. 2010 1:16 pm 7214ch03.

Work with Web Query (WRKWEBQRY) administration utility WRKWEBQRY is an administrative tool designed to assist a DB2 Web Query administrator with the following tasks: Determine if DB2 Web Query is Active View summary of current license status Start or End DB2 Web Query server jobs Force the end of DB2 Web Query server jobs Work with a list of all the users authorized to DB2 Web Query Work with a list of domains and add or remove user authorization to a domain 36 Getting Started with DB2 Web Query for i . You can use WRKLICINF 5733QU2. option 8 on 5050 to check). If ARCH or SHANEG already have a GRPPRF.7214ch03. Register ARCH as a licensed user (only necessary if this is the first time ARCH has been authorized as a developer. SUPGRPPRF. Log in to DB2 Web Query and creates a new domain from the DB2 Web Query home page. use the supplemental group profile option. If a user does not belong to any group profiles for a domain. the user must log off and back on to see the new Domain. – CHGUSRPRF USRPRF(ARCH) GRPPRF(MDMONTHEND) – CHGUSRPRF USRPRF(SHANEG) GRPPRF(MUMONTHEND) 4. – ADDWQLUSR USRPRF(SHANEG) Note: If you use the CHGUSRPRF command to change the group profile or supplemental profile parameter while a user is currently signed on to DB2 Web Query. Change the user profile of both ARCH and SHANEG. 2. the user will only be authorized run reports in the Common Domain. adding the domain's developer group profile to ARCH and the domain's user group profile to SHANEG. 2010 1:16 pm Let's say the administrator just created a new domain call monthend where the hrefname for that domain is also monthend. From the IBM i command line. create two new profiles that reflect developer and user access to the domain: – CRTUSRPRF USRPRF(MDMONTHEND) TEXT('Group profile for Developers of domain MONTHEND') – CRTUSRPRF USRPRF(MUMONTHEND) TEXT('Group profile for Basic Users of domain MONTHEND') 3. No other domains are visible to the user. ARCH is a developer and SHANEG is a basic user who runs read-only reports The administrator would do the following steps: 1.fm Draft Document for Review January 3. authorize MUMONTHEND as the shared license user for all basic users running reports in the MONTHEND domain. – ADDWQLUSR USRPRF(ARCH) 5. If you are using Run Time User Enablement to authorize SHANEG and as you know you just created the domain. – ADDWQLUSR USRPRF(MUMONTHEND) -ORIf you are not using Run Time user access then SHANEG must be explicitly licensed to use the domain.

The main menu is presented. Note: The WRKWEBQRY command is installed with PUBLIC *EXCLUDE. This screen displays the current status of DB2 Web Query and how many explicit licensed users of DB2 Web Query. press Enter. As with the previous example. This screen displays each domain's short Hrefname and the descriptive name. Sign on to a 5250 session with a user profile that has sufficient authority (as described in the call-out box above) 3. Take the following steps to complete the process using WRKWEBQRY: 1. 8/03/09 14:48:10 Work with DB2 Web Query LP12UT21 ______________________________________________________________________________ DB2 Web Query Status: Active Type options. 1=End DB2 Web Query 4=Force Server end 5=Work with users 8=Work with Domains *NOMAX 5 5 Maximum number of licenses for system Total licenses in use for system Licenses in use on this partition 8 ______________________________________________________________________________ F3=Exit F5=Refresh F12=Cancel Figure 3-11 Work with DB2 Web Query main menu The Work with DB2 Web Query Domains screen is presented. To display a panel with all the current users authorized to work with the MONTHEND domain. 2. DB2 Web Query fundamentals 37 . select option 8. assume that the administrator wants to create a domain called monthend and authorize ARCH as a developer and SHANEG as a basic user. 2010 1:16 pm 7214ch03. It also provides options to Start and End DB2 Web Query capability and the ability to Work with users authorized to use the product. so you need *SECOFR user class or *ALLOBJ special authority to issue the command or you must be granted explicit authority to the command. If your profile is granted access to the command it will automatically adopt enough authority to complete Web Query administrative tasks such as authority to create the group profile necessary under the covers necessary to secure domains for developers or users and enough authority to alter existing user profiles to supply specify those domain specific profiles as a group profile. and a column to indicate if the domain is currently enabled. To work with the list of DB2 Web Query domains.Draft Document for Review January 3. Chapter 3. Work with domains.fm To accomplish the same task as the manual steps in the previous section. 5. Log into DB2 Web Query as an administrator and create a new domain named monthend. Issue the WRKWEBQRY command. locate the MONTHEND domain and specify option 5 to Work with users. you can use the WRKWEBQRY utility. 4.

1=Add authority 4=Remove Authority Opt User Name WQADMIN Authorization ADMIN Bottom ______________________________________________________________________________ F3=Exit F5=Refresh F6=Add user F11=Sort by authorization F12=Cancel Figure 3-13 Work with DB2 Web Query Domain Users panel 6. this list is limited to users set up with the MRADMIN group profile.. Note: Because we just created the MONTHEND domain. press Enter.7214ch03. press Enter 1=Enable Domain 4=Remove Domain from system Opt Enabled YES YES YES YES YES 5 YES YES YES YES YES YES YES YES Domain ADVLAB99 COBBGRPP COMMON20 DB2WBQRY FLGHT400 MONTHEND NEUGCAM2 OTHLABXX PAYROLLR PERFORMA SAFDOMAI SECLABXX SPREADSH 5=Work with users Description Advanced Lab Template cobbg domain Common 2009 Sales and Marketing Demo Flight400 Reports Month End Reports NEUGC OthLabXX Payroll Reports Performance testing Structure Ad-Hoc Forms Domain SecLabXX Spreadsheet Client More. In the example. this is user profile WQADMIN 8/03/09 14:54:44 Work with DB2 Web Query Domain Users LP12UT21 ______________________________________________________________________________ Domain Name: MONTHEND Description: Month End Reports Type options. 38 Getting Started with DB2 Web Query for i . Press F6 to Add user. 2010 1:16 pm 8/03/09 14:51:22 Work with DB2 Web Query Domains LP12UT21 ______________________________________________________________________________ Type options. ______________________________________________________________________________ F3=Exit F5=Refresh F12=Cancel Figure 3-12 Work with DB2 Web Query Domains panel The Work with DB2 Web Query Domain Users screen is presented as shown in Figure 3-13..fm Draft Document for Review January 3.

the user is explicitly registered and consumes a license. You are returned to the Work with DB2 Web Query Domain Users screen. Chapter 3. 8/03/09 14:59:13 Add User Authorization LP12UT21 ______________________________________________________________________________ User Name: ARCH Type: DEV Valid types: ADMIN DEV USER SCHED Administrator Domain developer Domain user Report scheduler MRADMIN MD ( MONTHEND ) MU ( MONTHEND ) MRSCHEDULE Domain Name: MONTHEND ______________________________________________________________________________ F1=Help F3=Exit F12=Cancel . Enter all the information necessary to give user profile ARCH developer (DEV) access to the domain. If it is not installed. – SCHED is only applicable if Report Broker is installed. if this is the first time a developer has been added to this domain. Because ARCH is a developer. If the Runtime User Enablement option is installed the user can share the license of the group profile for the domain. ARCH will be registered as a licensed user and the profile MDMONTHEND will automatically be added as a group profile. The Add User Authorization screen is presented as shown in Figure 3-15. Press Enter to authorize ARCH as a developer to the MONTHEND domain. As a result of this request.fm 7. 2010 1:16 pm 7214ch03. 9. he can also be given schedule authority for reports in any domain he is authorized to as a developer. Figure 3-14 8.Draft Document for Review January 3. DB2 Web Query fundamentals 39 . the utility will automatically create the underlying MDMONTHEND profile. Press F6 again to add a new user and enter similar information to give user profile SHANEG basic USER access to the domain. In addition. The other valid types of authorizations possible are: – ADMIN will automatically register the user profile as a named user and specify MRADMIN as a group profile (thereby making the named user a DB2 Web Query administrator_ – USER gives the named profile the ability run (read-only) reports in the specified domain. Schedule authority allows ARCH to create Report Broker schedule entries for the automatic distribution of reports.

the administrator has the choice of either registering SHANEG explicitly as a licensed user or of registering the MUMONTHEND group profile as a runtime user license. You will now see that we have three users authorized to the domain. One is an administrator. 40 Getting Started with DB2 Web Query for i . 12.Press F12 to return to the Work with DB2 Web Query Domains screen. If the value for this setting is ‘Y’. 11. This is shown in Figure 3-16. Because Run Time User enablement is installed on this box. MUMONTHEND will be created and registered. Work with users for the domain MONTHEND.fm Draft Document for Review January 3.7214ch03. allowing other basic users to share the registration of MUMONTHEND. SHANEG would be registered as a named user. By default.Select option 5. or if N was specified for the Runtime Enablement setting on this screen. 2010 1:16 pm 8/03/09 15:01:38 Add User Authorization LP12UT21 ______________________________________________________________________________ User Name: SHANEG Type: USER Valid types: ADMIN DEV USER SCHED Administrator Domain developer Domain user Report scheduler MRADMIN MD ( MONTHEND ) MU ( MONTHEND ) MRSCHEDULE Runtime enablement: Y Domain Name: MONTHEND Enter Y or N ______________________________________________________________________________ F1=Help F3=Exit F12=Cancel Figure 3-15 Add User Authorization panel 10.Press Enter to authorize SHANEG as a user to the MONTHEND domain. one is a developer and the other is a run time user. Runtime enablement is set to ‘Y’. If Runtime enablement was not installed.

it does give you the ability to register users. press Enter.Draft Document for Review January 3. MUhrefname for 'other' domains the developer can only run reports in Chapter 3. Note: Although WRKWEBQRY does NOT allow you to create domains. It also manages the underlying changes to user and group profiles. 2010 1:16 pm 7214ch03. Table 3-3 User Type Administrator Group Profile requirement MRADMIN License requirement User profile is explicitely register using ADDWQLUSR or WRKWEBQERY User profile is explicitly registered via ADDWQLUSR or WRKWEBQRY Developer MDhrefname group profile specified for each domain the developer is authorized to develop reports.fm 8/03/09 14:54:44 Work with DB2 Web Query Domain Users LP12UT21 ______________________________________________________________________________ Domain Name: MONTHEND Description: Month End Reports Type options. Table 3-3 summarizes how the different user type gains access to report domains. 1=Add authority 4=Remove Authority Opt User Name ARCH SHANEG WQADMIN Authorization DEV USER ADMIN Bottom ______________________________________________________________________________ F3=Exit F5=Refresh F6=Add user F11=Sort by authorization F12=Cancel Figure 3-16 Work with DB2 Web Query Domain Users panel Note: The presented list was Sorted by user name. both named and runtime. You can press F11 to toggle the view to Sort by authorization as well. to access the domain. DB2 Web Query fundamentals 41 .

An advantage of Run Time User Enablement is if that if a user profile is deleted. ARCH is a developer and also a named license user. no explicit license. To view all users authorized to access DB2 Web Query domains and the type of license they consume. MUMONTHEND is a RUNTIME user that shares a license with all basic users with MUMONTHEND as a group profile. 2010 1:16 pm User Type User Group Profile requirement MUhrefname for each domain user is authorized to run reports License requirement Run Time User: MUhrefname is created and registered as the shared licensed user OR Not Run Time User: Base user profile is explicitly registered via ADDWQLUSR or WRKWEBQRY Note: The DB2 Web Query user license is not automatically removed when a user profile is deleted from the system. If you did a WRKLICINF 42 Getting Started with DB2 Web Query for i . Work with users on the main WRKWEBQRY menu.fm Draft Document for Review January 3. take option 5. you do not need to worry about removing the DB2 Web Query license (because the license belong to the group profile and not the user profile that was deleted from the system). This means you must explicitely remove the user’s registration before the license is freed up and can be used by another user profile. press Enter 4=Remove user from Web Query Opt User ARCH SHANEG WQADMIN 5=Work with authority Type Description NAMED Mike Archer USER Shane Garton NAMED Web Query administrator Bottom ______________________________________________________________________________ F3=Exit F5=Refresh F6=Add user F12=Cancel Figure 3-17 Work with DB2 Web Query Users WQADMIN is an administrator and therefore a NAMED license user. He gains access through the group profile.7214ch03. Figure 3-17 on page 42 illustrates the currently authorized users. 8/03/09 15:14:07 Work with DB2 Web Query Users LP12UT21 ______________________________________________________________________________ Type options. SHANEG is designated a USER.

CENTURY versus QWQCENT: The sample database was called CENTURY on the pre-GA version of the product. Tip: The data in the QWQCENT library contains sample data for the years 2006 and 2007. It is called QWQCENT in the GA version of the product. option 8 on the base option. All examples in the tutorials are based on the sample QWQCENT database.6 Developer tasks In this section. it is not a GUI representation of it.fm PRDID(5733QU2). This database contains four tables. 24) This is statement adds 2 years (24 months) to the values of the ORDERDATE column for all rows in the ORDERS table. This is a completely new tool for the IBM i platform. 2010 1:16 pm 7214ch03. all of the user profiles except SHANEG would be reflected in the list. we might refer to the CENTURY database in some places. and it has its own look and feel. The “knobs and buttons” are different. If you would like to update this data so that the year is something more recent. your results will be different than those in the tutorial examples of this Redbook. A developer does not need to know either Query/400 or SQL to use DB2 Web Query. 3. we describe the developer tasks for creating a DB2 Web Query report. Although DB2 Web Query is mentioned as a replacement for Query/400. for what is now the QWQCENT database. issue an SQL command similar to this one: UPDATE QWQCENTDEM/ORDERS SET ORDERDATE = ADD_MONTHS(ORDERDATE. The icons between the tables represent a foreign key constraint. The report writing process in DB2 Web Query is different than either of the former tools. can be downloaded from the IBM Redbook website. DB2 Web Query fundamentals 43 . Figure 3-18 on page 44 shows a Database map of the QWQCENT schema that was created using System i Navigator. We explain the steps that prepare you to write a report. For this reason. such as which adapter to use and creating metadata. Bear in mind that making this change will mean that for some reports. Chapter 3.Draft Document for Review January 3.

the table shown in Figure 3-19 on page 44 maps the equivalent terms between SQL and IBM i.7214ch03. SQL schema/collection table view index row column log i5/OS library physical file logical file keyed logical file record field journal Figure 3-19 SQL and i5/OS terminology 44 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. 2010 1:16 pm Figure 3-18 Database map of the QWQCENT (CENTURY) schema For those that are not familiar with SQL and its terminology.

record formats. field names. and the number of key fields (1). What is metadata Metadata is simply data about data. two stream files are created in a folder in the Integrated File System (IFS): the access file and the master file. 2010 1:16 pm 7214ch03.6. Before you can create a report or graph in DB2 Web Query you must first create metadata (also referred to as synonyms) over the data sources. A very simple example of an access file would look something like this: SEGNAME=FL400_FRCITY. $ Figure 3-20 DB2 Web Query Access file example The access file consists of multiple keyword-value pairs that are separated by commas. DB2 Web Query fundamentals 45 . Attributes included are the name of the synonym segment (FL400_FRCITY). whenever you create a synonym over a database object. TABLENAME=FLGHT400C/FRCITY. In much the same way. which are files that store information about each of the objects in your database. and field lengths. CONNECTION=*LOCAL. Chapter 3. DB2 for i also maintains system catalogs. what is generated and displayed on your screen is in fact metadata: information such as record lengths. field attributes.ACX and contains the file level information such as the type of object and the library that it resides in. They are effectively a materialized metadata repository that is kept up to date and can be queried to collect a wide variety of information about your database. The metadata requirement of the DB2 Web Query product may be foreign to you: many IBM i customers are simply not accustomed to working with a product that requires metadata and consequently view it as an unnecessary burden: an extra layer of complexity that they have to create and maintain. Typical questions include the following: What exactly is metadata? Why do I need it? Can't I just query my files directly? What happens if the structure of my underlying files change? This section explains what metadata is and why you should consider it as advantageous feature: something that can actually reduce the complexity of your query and reporting environment and make life easier for your report developers. KEYS=1.1 Metadata Before you can create a single report or graph in DB2 Web Query. data types. DB2 Web Query metadata is a materialized repository that contains information about your database files.Draft Document for Review January 3.This file has an extension of. You can create a synonym over the following database objects: Tables/physical files SQL views DDS Logical files Stored procedures Materialized Query tables In general. Whenever you issue the DSPFD or DSPFFD commands. you must create metadata (also known as synonyms) over the data source.fm 3. Access file . the underlying table that is referenced is (FRCITY in library FLGHT400C). the system to connect to in order to find the data source object (*LOCAL).

This greatly simplifies the environment for the report developers. ALIAS=FRCNAM. and the title to be used in report column headings. TITLE=' FROM. and length.fm Draft Document for Review January 3. USAGE=A3. By empowering more and more of your users.AIRLINE'. USAGE=A3. ACTUAL=A3. Typically these two stream files are located in the following folder in the system's Integrated File System (IFS): /qibm/UserData/webquery/ibi/apps/baseapp The exception to this is if you have requirements to secure or segment your metadata. ACTUAL=P2. $ FIELDNAME=FRCINT. the ALIAS (the underlying field name in the file). ACTUAL=A16.INITIALS'. SUFFIX=DB2. $ FIELDNAME=FRCNBR. Here is an example of the contents a master file: FILENAME=FL400_FRCITY. USAGE=P4. ALIAS=FRCNBR. ACTUAL=A3. In those cases. SEGTYPE=S0. the data type and length (for both how it is used in reports and actually defined in the file). The really nice thing about metadata is that it can be an abstraction layer: you can build business logic into the metadata so that all reports and graphs that reference those synonyms have access to all of that logic. some work needs to be done to build up this abstraction layer. Benefits of metadata The primary objective of the metadata layer is simple: improve the productivity of the DB2 Web Query report developers by providing an abstraction layer and burying the database complexity. TITLE='CITY NAME'. USAGE=A16. you can reduce their dependence on IT and the number of backlogged reporting requests. CITY. a custom folder (referred to as an application folder) can be created and associated with a specific DB2 Web Query domain (more on this in section “Creating an application folder for segmented metadata” on page 80). ALIAS=FRCALN.This file has an extension of . But before this can happen. This Windows PC based tool contains several powerful components. $ FIELDNAME=FRCALN. ALIAS=FRCINT. These include the name of the field. the master file uses a keyword-value pairing technique to define the column attributes. 2010 1:16 pm Master file . $ SEGMENT=FL400_FRCITY. you will need the DB2 Web Query Developer Workbench tool. REMARKS='City table for building Flights (From City)'. $ Figure 3-21 DB2 Web Query Master file example Similar to the access file. TITLE=' CITY. one of which is the Synonym Editor. $ FIELDNAME=FRCNAM. data type. A simple and intuitive data model also means you can extend the report developer community because it does not require an intimate knowledge of the database. For this.MAS and contains the column (field) level information such as column name. The Synonym Editor contains graphical tools and interfaces that will allow you to do the following: Define database joins Build virtual columns to centralize business logic Standardize column formats Convert and standardize date fields Create filters Create Business Views Define OLAP dimensions 46 Getting Started with DB2 Web Query for i .7214ch03. TITLE=' CITY. Report developers can be more productive if you keep the data model simple.NUMBER'.

To create metadata.com) generates the metadata based on the data model it derives from both database definitions and business logic buried in application programs. It can also use this extracted information to generate the necessary dimensions for instant OLAP capabilities. Provided by ERP or Services Provider ISV's have the ability to include DB2 Web Query content as part of their solutions package. In most cases. Some examples of this include: – Databorough x-WebQuery product (www.com) and Coglin Mill's RODIN DB2 Web Query Edition (www. Open a web browser and enter the URL of the DB2 Web Query home page. If you purchase such a distribution. Through the use of third-party tools. On the DB2 Web Query home page. In most cases you are going to create your own metadata using the provided metadata creation wizards.fm Creating metadata DB2 Web Query metadata can be generated in multiple ways. the metadata will be included in the package. Right-click the specific report folder and select Metadata (Figure 3-22). see Appendix A. expand the domain in which you want to work. Create your own Metadata creation wizards are available from both the web browser via the Web Query launch page and in the DB2 Web Query Developer Workbench tool (more on this tool later).thinkrodin.ibi.com) products generate the metadata in conjunction with building a data mart or data warehouse. 2010 1:16 pm 7214ch03. Expand Reports. a services provider may have the expertise and tools to build the metadata for you. take the following steps: 1. To do this. – Information Builders's iWay Data Migrator (www. For more information about what is created on the system. Chapter 3. Similarly. DB2 Web Query fundamentals 47 .Draft Document for Review January 3. Each technique is discussed below. you must either be a Web Query administrator (member of group profile MRADMIN) or a developer in the domain. “Metadata in the integrated file system” on page 511.databorough. this is how the metadata is created. 2.

refer to 1.5. select the database to which you want to connect from this panel. we use DB2 cli. If you have a connection to a remote database. “Data adapters” on page 13. Click Next. enter your collection name. To learn more about Data Adapters. Notice that we click the *LOCAL connection. select the adapter that matches the data on which you will create metadata.7214ch03. Click the adapter type and select Create Synonym as shown in Figure 3-23. we select Tables because want to create metadata on a table in QWQCENT. In this example. Select the type of data that you want to query. 2010 1:16 pm Figure 3-22 Selecting the Metadata option 3. Figure 3-23 Creating a synonym 4.fm Draft Document for Review January 3. In the Library field. 48 Getting Started with DB2 Web Query for i . In the Configuring Data Adapters pane (Figure 3-23). which is for a single member file. In our example. type qwqcent.5. In the Select Synonym Candidates for DB2 cli pane (Figure 3-24 on page 49).

In this panel. This way. You might want to include a prefix or suffix. because the table resides in library QWQCENT. you can search on all metadata that starts with the library name. yet recommended): The prefix and suffix are optional letters that you can add to your synonym name to provide extra meaning for you. 2010 1:16 pm 7214ch03.Draft Document for Review January 3. Click the Create synonym button. select the table names for which you want to create reports. cen_ is our prefix. DB2 Web Query fundamentals 49 . Prefix and suffix (optional. when you create your reports. It is up to the developer to decide whether it is necessary to use the prefix and the naming convention that is preferred. The Create Synonym for DB2 cli pane (Figure 3-25 on page 50) is displayed and shows all the different tables that reside on the QWQCENT (Century) schema. Chapter 3. Using a prefix or suffix is not required. Leave baseapp for Application. We leave the suffix blank. We recommend that you use the library name or an abbreviated version of the library name for the prefix.fm Figure 3-24 Selecting the schema or library 5.” The box is rather small and does not list the metadata according to library. but the developer has the choice to use it. In our example. Keep in mind that all metadata is displayed in one box called “Database Descriptions.

views. depending on how many items you selected. Tables. aliases.fm Draft Document for Review January 3. you see the message “Created successfully” as shown in Figure 3-26. and MQTs. Figure 3-26 Created successfully message The process of creating metadata is now complete. you will be unable to tell which object type you are using in your report. and access all the functionality of Report Assistant. 50 Getting Started with DB2 Web Query for i . stored procedures. compute. After the processing is done. aliases and MQTs are treated identically by DB2 Web Query. You are ready to begin the tutorials in Chapter 5. sort. join.7214ch03. in the Status column. define. “Report Assistant” on page 97. All of them can be used to filter. After you create the metadata. views. Miscellaneous considerations about creating metadata The DB2 CLI adapter can create metadata on five different i5/OS object types: tables. 2010 1:16 pm Figure 3-25 Selecting tables from a schema or library The metadata takes a few seconds to create.

then executing the appropriate process to return the result set. Stored procedures can be written in the SQL procedural language. Provide auditing capability. Sarbanes-Oxley). By combining DB2 Web Query with existing report programs.e. Consider the following list of ways a stored procedure could be used with the tool: Reuse and repurpose the business logic in your existing programs. yet under utilized feature of DB2 Web Query is its ability to use a stored procedure as a data source . this can be very important consideration especially for users that have access to sensitive information.You can take an existing RPG program. The stored procedure can include logic to insert a row in an audit log table to record any report request.) and register them to the database as stored procedures. data queues. JAVA. and return the results to the report. DB2 Web Query has the ability to capture that result set and use it as the source data for a report. COBOL. But a very powerful. Comment out the header lines. Use native record level access (RLA). or you can use existing programs or service program procedures (written in RPG. When a DB2 Web Query synonym is created over a stored procedure. and change the details line to write to a result set.Draft Document for Review January 3. let the procedure use those values to perform the business logic. etc. instead of SQL.provided the stored procedure returns a result set. the result set is used as the format for synonym. Provide a way to dynamically change the library list by passing an input parameter to the stored procedure (and changing the library list based on that parameter value). This is a powerful technique because it gives the report developer programmatic control over what is returned to DB2 Web Query. With so much attention given to security and auditing these days (i.fm Stored procedure synonyms A stored procedure is a program or procedure in a service program that can be called by an application using the SQL CALL statement. 2010 1:16 pm 7214ch03. and register it to the database as a stored procedure. Consequently you can pass parameter values from a report to the stored procedure. and system API’s as well as pull data from other system objects such messages queues. you can salvage proven business logic and provide a modernized output format for those “old” reports. temporary file. This means that all fields in the result set can be used as columns in the report. DB2 Web Query fundamentals 51 . (or one written in any language supported by the IBM i) make some small modifications to return a result set. or array. Examples of what can be specified in a stored procedure to change the environment: – SET CURRENT DEGREE to enable Symmetric Multi Processing (SMP) and boost query performance of a long running report if requestor is an executive or other high profile user. This gives you the ability to restrict access to the database objects and only allow users to access the objects through the programs (stored procedures) with adopted authority. In addition. rather than a print file record. many developers only use database objects like tables and views. – SET OPTION SRTSEQ to change the collating sequence of the report. commands. When it comes to DB2 Web Query data sources to base their reports on. Provide ability to programmatically change attributes of the querying job. This means that many existing reports generated by RPG programs could be converted to work with DB2 Web Query. Chapter 3. if you prefer that method of data access Provide ability to call to other programs. or data areas. the input parameters of the stored procedures can be used as input parameters for the report. Adopt authority of the user profile that owns the underlying program or service program.

It is a good idea to specify this clause to ensure that the result set is returned to the client application. SESSION_USER). From the Select Synonym Candidates for DB2 cli (*LOCAL) Step 1 screen. name of the report. Take the following steps: 1. specify the library. OPEN c1 . “WITH RETURN TO CALLER” is the default. 'HR Salary Report'. and requesting user profile must be logged to an audit table. rptname CHAR(25). END P1 .rptusrprf CHAR(10)) 2. each time the report is run. The cursor is opened (and left open). create the audit table: CREATE TABLE rptaudlog (rpttimst TIMESTAMP. 2010 1:16 pm To illustrate how a stored procedure could be used. create the stored procedure: CREATE PROCEDURE hr_table_audit (inplantcode CHAR(3)) DYNAMIC RESULT SETS 1 LANGUAGE SQL NOT DETERMINISTIC MODIFIES SQL DATA P1 : BEGIN DECLARE c1 CURSOR WITH RETURN TO CLIENT FOR SELECT lastname. status. 52 Getting Started with DB2 Web Query for i . let’s assume that you need to create a report that returns rows from a sensitive table (the HR table) and you must add an auditing feature to this report. The INSERT statement is specified to log the request. INSERT INTO rptaudlog VALUES(CURRENT TIMESTAMP. payscale. which would cause problems in the event you had a nested stored procedure (a stored procedure called by another stored procedure) that was actually returning the result set. That is. From same SQL interface. information such as the timestamp. select Stored procedures from the Restrict object type to dropdown list. To create a stored procedure that returns data from specific columns in the payroll table and satisfies the auditing requirement take the following steps” 1. This satisfies the auditing requirement. Several things need to be pointed out in this store procedure: The cursor is declared with the “WITH RETURN TO CLIENT” clause specified.7214ch03. salary FROM hr WHERE plantcode = inplantcode. and click the Next button as shown in Figure 3-27 on page 53. From an SQL interface such System i Navigator Run SQL Scripts.fm Draft Document for Review January 3. This returns a result set to the client application (which is DB2 Web Query) The process for creating a stored procedure synonym is similar to that of creating a synonym over a table. firstname.

2010 1:16 pm 7214ch03. the stored procedure is actually called by DB2 Web Query so that it can receive the result set. you need to pass it a valid value for the input parameter at this step. Chapter 3. From the list of stored procedures displayed. Consequently. DB2 Web Query fundamentals 53 . 3. you will be prompted to enter a valid value for the input parameter.fm Figure 3-27 Creating stored procedure synonym step 1 The Select Synonym Candidates for DB2 cli (*LOCAL) Step 2 or 3 screen is displayed. 2. select HR_TABLE_AUDIT as shown in Figure 3-28. Note: When the synonym is created. Figure 3-28 Creating stored procedure synonym step 2 If the stored procedure has input parameters.Draft Document for Review January 3. As demonstrated in Figure 3-29 on page 54. specify a valid input parameter value by taking these steps: – Select/check the INPLANTCODE parameter – Specify ORL as the value for the input parameter (this is a valid Plant Code value) – Click Create Synonym. This is because it needs to store the format of the result set in the synonym.

6. In general. 2010 1:16 pm Figure 3-29 Creating stored procedure synonym step 3 As shown in Figure 3-30. which enables your query to use the DB2 CLI adapter and makes the query eligible for SQE. where OPNQRYF must still go down the CQE path. In this case. SQL can go down the codepath of the newer SQE.7214ch03. As indicated earlier. “Creating a report over a stored procedure synonym” on page 144. Multiple result sets: DB2 Web Query supports the return of multiple result sets from the stored procedure. A limitation of SQL is that it can only read data from the first member in a file. where the DB2 Heritage File adapter sends the OPNQRYF CL commands.fm Draft Document for Review January 3. The alias is a permanent i5/OS object that 54 Getting Started with DB2 Web Query for i . SQE tends to be faster than CQE. Perhaps you have run into this limitation when writing SQL queries on multimember files before. One option is to consider using an SQL alias. Considerations with multimember files As noted in Table 1-2 on page 14. see 5. the DB2 CLI adapter sends SQL statements to i5/OS. a confirmation window is displayed to confirm that the stored procedure synonym was successfully created. DB2 for i5/OS optimizes SQL and OPNQRYF differently. it assigns a distinct segment name to the fields of each separate result set. Figure 3-30 Stored procedure synonym created For an example of how to create a report over this synonym.

For example.Draft Document for Review January 3. if the database administrator alters a table and either adds a new column or removes an existing one. However. This message might provide extra incentive to create an alias and use the DB2 CLI adapter. and after it exists. a synonym refresh is not required. do existing reports still run successfully? The answer to this is "it depends" . Figure 3-31 Error message regarding joining on non-key fields Refreshing metadata (when IBM i database object structure changes) A common concern for many customers is what happens when the metadata gets out of synch with the underlying data source. Refer to “Creating metadata” on page 47. The DB2 Heritage File adapter also has the limitation of only being able to join on key fields. you receive an error message (see Figure 3-31).fm “points” to a specific member in a file. if the changes do impact your reports. there is an option from the right-click menu DB2 Web Query Developer Workbench to refresh the synonym. SQL treats the alias the same as it would a table.the synonym may need to be refreshed to reflect this change. Chapter 3. which explains how to create DB2 Web Query metadata. If you try to join on non-key fields using the multimember file adapter. The same applies if you do not want to include the new column in any existing or new reports. DB2 Web Query fundamentals 55 . You can create metadata on an alias as easily as you can on a regular table. STRSQL has a prompt for CREATE ALIAS that is intuitive. You simply substitute the alias name in any query where you would put a table name. Here is an example of a CREATE ALIAS command in SQL: CREATE ALIAS QGPL/MYALIAS FOR QGPL/MULTI_MBR_FILE (MBR_NUM_2) You can run this command in the Run SQL Scripts window of iSeries Navigator or in STRSQL from the command line. This is shown in Figure 3-32. For this. If none of your reports reference a column deleted from the underlying file. It is easy to create. you will need to synchronize the synonym with the altered file. 2010 1:16 pm 7214ch03.

you do not need to recreate the metadata. you must create new metadata on that objects. Referential Integrity In this section. virtual columns. A database can consist of one large fact table and several smaller dimension tables. You have the option to recreate the table or QRYDFN exactly as it was before. If you do not fully grasp the meaning of referential integrity. those changes are not applied to the synonym. Therefore. the synonym will either have to be manually edited or recreated. For our example. filters. Or if you create a new. the primary key on the Inventory table is PROD_NUM. the synonym is parsed and its contents are compared with the structure of the actual underlying data source. For those types of changes. to DB2 Web Query. 2010 1:16 pm Figure 3-32 Refresh Synonym When this action is taken. New columns are added to the synonym and deleted columns are removed. We begin by briefly explaining referential integrity.) that were made to the synonym are preserved Attention: Refresh synonym will not update the synonym for all database object changes. we explain the benefits. the DB2 Web Query report cannot run based on the metadata alone.fm Draft Document for Review January 3. of having referential integrity defined in the database. For example. Any custom changes (joins. What happens to the metadata if the IBM i database object is deleted If you delete the underlying database or the QRYDFN object. if column attributes such as data type or length are altered in the database object. you are not alone. A feature of a relational database is that it must support the definition and enforcement of referential integrity. you receive an error message. OLAP dimensions. yet slightly different object.7214ch03. The dimension tables each contain a primary key that is referenced by a foreign key in the fact table. etc. and the 56 Getting Started with DB2 Web Query for i . If you attempt to run the report in DB2 Web Query.

That is. you can do this easily by using iSeries Navigator. you select a single synonym or table name that includes several files that are all related to each other. 2. An entry in the fact table is not allowed unless there is a matching key in the dimension tables. we set up referential integrity between the Orders table and the Inventory table. you must have defined constraints on your tables. and Stores tables are the dimensional tables. Think of it as a parent that has many children. If you want to add constraints by using SQL. it recognizes files that are related through referential integrity and brings them all in together in one piece of metadata. Tip: You can also think of the small dimension tables as “parent” tables. For our example. First we must create a primary key in INVENTORY. If you do not currently have referential integrity in your database. The Orders table is the fact table. Referential integrity constraints can be added to files that are created with DDS and CRTPF. entries in the Orders table. 2010 1:16 pm 7214ch03. Do not let the part about the child table being larger confuse you. use the ADDPFCST command. right-click Schemas and then Select Database to display. This prohibits unmatched. Expand the database container. The following brief example demonstrates how to set up referential integrity on our sample QWQCENT database. If the Century (QWQCENT) database is not currently displayed. When you write your report. You do not need to manually define all the table joins.Draft Document for Review January 3. DB2 Web Query fundamentals 57 . Benefit of using referential integrity in DB2 Web Query When DB2 Web Query creates metadata. An item must exist in the Inventory table before it can have a “child” in the Orders table. we strongly recommend that you consider implementing it. The constraint does not let the child be born unless the parent already exists. or “orphan”. The referential constraint starts at the child table and ensures that no child entry is inserted into the table unless an entry exists in the parent table. Chapter 3. The relationship between the two is called a referential constraint. and the large fact table as a “child” table. Tip: If you want to add constraints by using the command line. Creating a primary key on INVENTORY field PROD_NUM Open iSeries Navigator and follow these steps: 1. use the CREATE TABLE or ALTER TABLE statement. Plant. The Inventory. and then we can create the foreign key in ORDERS. you are not allowed to place an order for a product that is not confirmed to be in your inventory. or they can be added to tables that are created with the CREATE TABLE statement. Not only does referential integrity aid in more effective report writing in DB2 Web Query.fm corresponding foreign key on the Order table is PROD_NUM. but it also moves your business logic closer to the database level to reduce the programming effort. In order to have this convenience. The referential constraint does not permit an entry into the Orders table unless the entry has a value for PROD-NUM in the Inventory table. You do not need to understand SQL to add constraints to your database.

In the left navigation bar of iSeries Navigator. type Century and click Add. expand the CENTURY database and click Tables.fm Draft Document for Review January 3. Then click OK. Figure 3-33 Select Schemas to Display window 4.7214ch03. right-click the INVENTORY table and select Definition as shown in Figure 3-34. In the Select Schemas to Display window (Figure 3-33). In the right pane. 2010 1:16 pm 3. in the Enter schema names field. 58 Getting Started with DB2 Web Query for i .

click the Key Constraints tab and then click Add.Draft Document for Review January 3. complete these steps: a. In the New Key Constraint window (Figure 3-35). Under Available columns. 2010 1:16 pm 7214ch03. c. 6. In the next window. Under Constraint type. DB2 Web Query fundamentals 59 . select the ProductNumber field and click the Add arrow button. Click OK. select the Primary Key radio button. b. Now the ProductNumber field is displayed under Selected columns. Chapter 3.fm Figure 3-34 Selecting the Definition option 5. from the tabbed selections.

For Table name. click the Foreign Key Constraints tab.7214ch03. Click Add. Next. Remember that the Orders table checks the Inventory table to ensure that any new record also has a matching key value in Inventory. and select Definition. 2. 3. select Inventory. click OK. Figure 3-36 Key Constraints tab showing the ProductNumber field You are now finished creating the primary constraint on the Inventory table. we go to the Orders table and create a referential constraint. In the window that contains the various tabs (Figure 3-36).fm Draft Document for Review January 3. complete these steps: a. 2010 1:16 pm Figure 3-35 Key Constraints window 7. Expand the Century schema and click Tables. In the New Foreign Key Constraint window (Figure 3-37). 1. Right-click the Orders table. In the next window. 60 Getting Started with DB2 Web Query for i .

Draft Document for Review January 3. After you are done creating the other two referential constraints. 2010 1:16 pm 7214ch03.fm b. You can now repeat this process with the two other dimension tables. We know this is the primary key on the Inventory table because it is indicated under Key columns near the top of the window on the right. The Orders table has the corresponding foreign key for each table as it did for the Inventory table. Click OK. Store_Code and Plant_Code. Under Available Columns. The key fields on those tables are. respectively. your database is now ready for metadata creation. Figure 3-37 New Foreign Key Constraint window You are now finished creating the referential constraint between the Inventory and Orders tables. select ProductNumber and click Add. c. DB2 Web Query fundamentals 61 . Chapter 3. Stores and Plant.

Review “Creating metadata” on page 47. Then click Create synonym. but the final metadata creation is the same. In the Create Synonym pane (Figure 3-38). the only table that you need to select is the fact table. Then. You can close this panel. notice the With foreign keys check box at the top of the page. You must select With foreign keys so that the related tables are included in the same piece of metadata.fm Draft Document for Review January 3. Figure 3-38 Creating metadata with referential integrity Next the status pane (Figure 3-39) is displayed on which you see a status message of “Created successfully”. You can check all the related tables if you want to. This is the difference in the process.7214ch03. which in our case is the ORDERS table. 2010 1:16 pm Creating metadata on tables with referential integrity The process to import a “cluster” of related tables into one piece of metadata is similar to creating a single piece of metadata. The dimension tables are automatically included. Notice that there is only one piece of metadata. 62 Getting Started with DB2 Web Query for i .

2010 1:16 pm 7214ch03. The related files are all under one name.Metadata with referential integrity Chapter 3. you are presented with the metadata window.Draft Document for Review January 3. Figure 3-40 Cluster .fm Figure 3-39 Created successfully message When you first start to write the report based on the file cluster. the description says “Cluster xxx for table yourFactTable” like the example in Figure 3-40. All the related dimension tables with referential constraints defined appear in Report Assistant. The word “Cluster” in your metadata indicates that referential integrity has been used to create that metadata. DB2 Web Query fundamentals 63 .

the list of columns can be presented alphabetically or by segment. 64 Getting Started with DB2 Web Query for i . 2010 1:16 pm When you create a report. they can be thought of as non-keyed logical files. In our case. Figure 3-41 Field selection sorted by table Creating metata over tables without referential integrity While there are many advantages to implementing referential integrity. This means you can create as many views as you like and not worry about performance repercussions associated with access plan maintenance. This means that an administrator and/or developer has the following three options if tables need to be joined together. segment means table. Defined in SQL views Defined in the DB2 Web Query metadata layer Defined in the reports and graphs Each of the above options are discussed in the following sections. See Figure 3-41.7214ch03. Defining joins in SQL views An SQL views is a virtual table whose definition is based on a SELECT statement. In traditional i5/OS terms. many existing DB2 for IBM i production databases currently do not have RI set up. there is no access path maintenance. Because there are no keys associated with views.fm Draft Document for Review January 3.

c. 2010 1:16 pm 7214ch03.*.prod_num = c. ODBC. d. For more information on this. DB2 Web Query join syntax is stored in metadata and translated to an SQL statement with join syntax. PRODUCTNUMBER FOR COLUMN PROD_NUM. including the following: Encourages database optimization (“pushes” logic down to DB2) Provides method for implementing more complex reporting requirements such as row and column level security Provides additional join types. complex business logic (case statements. see “Performing analysis and looking for optimization disablers” on page 466 Chapter 3. SQL views are particularly useful because they can used to join tables together.storecode INNER JOIN inventory c ON a. This is an example of the power of the metadata abstraction layer.prod_num INNER JOIN plant d ON a. When this technique is employed. Reports using that synonym can access any of the columns from each of the join segments defined in the view. b. Once the view is created DB2 Web Query metadata can be created over the view (instead of the base tables).* FROM orders a INNER JOIN stores b ON a.. Defining joins in DB2 Web Query synonyms You can also define the file relationships in the DB2 Web Query metadata. intersects.*. DB2 Web Query fundamentals 65 .*. etc. Using reports based on SQL views provides several distinct advantages to DB2 Web Query. unions. SQL views can be accessed by other interfaces such as RPG programs (with embedded SQL or native Record Level Access). Because the joins are defined at the synonym level. etc. The following should be considered when using this technique: Requires DB2 Web Query Developer Workbench to edit the synonym and define the join segments Can be accessed by all DB2 Web Query reports and graphs that use the synonym.plantcode A synonym created over the example SQL view would contain all of the columns in the joined tables.) Data-centric because business logic and rules can be defined in one place (at the database level) rather than the application level In addition. you only have to do this in one place. thus it is not necessary to define joins in each report.. Performance could suffer if logic is not pushed down to database due to database optimization disablers. JDBC™.fm For DB2 Web Query. Every report that uses this synonym will have access to the join logic already defined.plantcode = d. Common Table Expressions. Example 3-1 CREATE VIEW ORDERSVIEW (ORDERNUMBER FOR COLUMN ORDER_NUM. excepts.. It is not accessible from any other SQL interface.storecode = b.) AS SELECT a.Draft Document for Review January 3.

). Keys and sequences are defined in the access file. Therefore Unique join types are defined. select cen_orders. Expand Data Servers → EDASERVE → Applications → baseapp 4. With the Multiple segment type. and log in using your user profile and password 3. Under the contents of baseapp in the right navigation pane. 2010 1:16 pm Before you begin this exercise. the result is one virtual segment. Expand WebFOCUS Environment → your-system-name. This will prevent something called the multiplicative effect but will also not allow a developer to write a report that sorts (or performs a combination of sorting and selecting) across the different segments.fm Draft Document for Review January 3. but could also result in a report that delivers incorrect results due to the multiplicative effect. every child segment becomes logically part of the parent. regardless of whether or not a matching row was found. If no matching row is found based on the join criteria. no row is returned to the join. If there is a one-to-many relationship between parent and child.7214ch03. This provides the ability to sort and/or select fields across the underlying segments. 1. For this exercise. ALL children will be returned (despite the name "Unique" which would indicate a one-to-one relationship. Since the child becomes an extension of the parent. we are not concerned about the multiplicative effect.mas and from right-click menu select Edit in Synonym Editor as shown in Figure 3-42 on page 67 66 Getting Started with DB2 Web Query for i . each joined file is represented as an individual join segment. Unique (SEGTYPE=U) For each join definition. At least one row will be retrieved. 2. you need to have a basic understanding of the different types of joins that DB2 Web Query supports: Multiple (SEGTYPE=S0) Indicates that the segment has no key field and is therefore not sorted. Open DB2 Web Query Developer Workbench.

2010 1:16 pm 7214ch03.fm Figure 3-42 Edit in Synonym Editor The cen_orders master file is opened in the synonym editor. 5. Chapter 3. DB2 Web Query fundamentals 67 . Right mouse click on the CEN_ORDERS segment and select Add → Segment From Existing Synonym as shown in Figure 3-43 Figure 3-43 Add join segment to synonym The list of existing synonyms is presented.Draft Document for Review January 3.

From the presented list. 68 Getting Started with DB2 Web Query for i .7214ch03. the icon next to the CEN_INVENTORY segment becomes a red color. Select the segment CEN_INVENTORY segment and change the join segment type (SEGTYPE → Type) setting from Multiple (the default) to Unique as shown in Figure 3-45. select the cen_inventory synonym as shown in Figure 3-44 and click the Select button. Figure 3-44 Select synonym to add The segment CEN_INVENTORY is added under CEN_ORDERS 7.fm Draft Document for Review January 3. 2010 1:16 pm 6. Figure 3-45 Specify Unique join segment Note: Once you have changed the Segment type to Unique.

2010 1:16 pm 7214ch03. Select this field under both tables and click the = button. PRODUCTNUMBER is the field that is used to join ORDERS to INVENTORY. Figure 3-47 Specify join columns Chapter 3.fm Figure 3-46 Join properties 8.Draft Document for Review January 3. Make sure Inner Join is selected for the Join Type. DB2 Web Query fundamentals 69 . (located between the tables lists) as shown in Figure 3-47 on page 69.

The join field for this join is PLANTCODE 12.At this point.Repeat steps 5 on page 67– 9 for the CEN_PLANT segment. you have created a “cluster” for the ORDERS table. Click the OK button 10. Figure 3-48 Join columns in expression 9.fm Draft Document for Review January 3.Repeat steps 5 on page 67– 9 for the CEN_STORES segment. 2010 1:16 pm This will bring the join formula into the Expression® pane as shown in Figure 3-48. The join field for this join is STORECODE 11. The segments of this cluster should look like the example shown in Figure 3-49. 70 Getting Started with DB2 Web Query for i .7214ch03.

Finally. DB2 Web Query fundamentals 71 .fm Figure 3-49 CEN_ORDERS with all join segments 13. Figure 3-50 Save synonym Chapter 3.Draft Document for Review January 3. save your work by clicking the Save icon as shown in Figure 3-50 on page 71. 2010 1:16 pm 7214ch03.

In iSeries Navigator. Under the expanded connection. If you already defined a remote database using the WRKRDBDIRE command.fm Draft Document for Review January 3. In the following task. 2010 1:16 pm Defining joins in DB2 Web Query reports 3. Open iSeries Navigator. 2.7214ch03. The restriction here is that all databases (both local and remote) must be DB2 for i5/OS. we explain how to create a connection to a remote DB2 on a IBM i machine. 1. right-click Databases and select New → Relational Database Directory Entry as shown in Figure 3-51 on page 72. A cross-system join is a join in which the underlying base tables reside on multiple IBM i machines.6. This means that you can create reports against data that resides on the following systems: The local system A remote IBM i machine or logical partition (LPAR) A combination of both the local system and a remote IBM i machine or LPAR This feature provides the foundation for creating a report with a federated or cross-system join. Figure 3-51 Selecting the option to create a new Relational Database Directory Entry 72 Getting Started with DB2 Web Query for i . expand the desired connection name.2 Setting up a cross-system join The base version of DB2 Web Query provides the ability to access tables and views on remote systems. you can skip the first three steps.

In most cases. DB2 Web Query fundamentals 73 . – Remote location type This refers to the protocol that is being used to communicate between the two systems or partitions. you specify *IP for this setting. In the Add RDB Directory Entry (ADDRDBDIRE) window (Figure 3-52). – Remote location name or address This is either the fully qualified system or partition name or the IP address. It is usually the name of the remote system or partition. specify the following options: – Relational database This is the logical name to assign to the relational database.fm 3. Figure 3-52 Add RDB Directory Entry window in iSeries Navigator Tip: Another option is to use the CL command ADDRDBDIRE. Click OK. Chapter 3.Draft Document for Review January 3. 2010 1:16 pm 7214ch03.

The name must match the Relational Database value that is specified during the Add RDB Directory Entry step. – Security There are three methods by which a user can be authenticated when connecting to a DB2 database server: • Explicit The user ID and password are explicitly specified for each connection and passed to DB2. 74 Getting Started with DB2 Web Query for i . for example: http://yoursystemname:11331/webquery 5. right-click. • Trusted The adapter connects to DB2 as a Windows login using the credentials of the Windows user. 6. 2010 1:16 pm 4.7214ch03. – User For Explicit security only.fm Draft Document for Review January 3. specify the following options: – Connection Name This is the logical name that is used to identify this particular set of connection attributes. Select Data Adapter from the menu bar. for authentication. 8. – Datasource This is the DB2 database name that is used for this connection. In the Data Adapters window (Figure 3-53). this field is for the i5/OS user profile. who impersonated by the server data access agent. at connection time. Open your Web browser to the DB2 Web Query console on port 11331. Enter your IBM i user ID and password. for authentication. In the Add Connection for DB2 cli pane (Figure 3-54 on page 75). 7. but it does not have to match any value that is specified during the Add RDB Directory Entry step (step 3 on page 73). Navigate down to any folder under Reports. Figure 3-53 Adding a connection to data adapters 9. and select the Metadata option. at connection time. click DB2 cli and select Add connection. It is usually the remote system or partition name. • Password Passthru The user ID and password received from the client application are passed to DB2.

Draft Document for Review January 3. Figure 3-54 Add Connection for DB2 cli pane 10. In the Data Adapters window (Figure 3-55). 2010 1:16 pm 7214ch03. Figure 3-55 Selecting the Create Synonym option Chapter 3. DB2 Web Query fundamentals 75 . Click the Configure button.fm – Password For Explicit security. this field is for the password that is associated with the specified i5/OS user profile.Create the synonyms for the remote tables or views that you want include in your reports: a. click the remote connection and select Create Synonym.

views. Click Create synonym. Figure 3-57 Create Synonym for DB2 cli pane 76 Getting Started with DB2 Web Query for i . Click Next. select Tables and Views. for Restrict object type to. Then specify the name of the Library (schema) that contains the database objects that you want to include in the cross-system join.7214ch03. In the Create Synonym for DB2 cli pane (Figure 3-57). Figure 3-56 Select Synonym Candidates for DB2 cli pane c. or both that you want to include in the cross-system join.fm Draft Document for Review January 3. In the Select Synonym Candidates for DB2 cli pane (Figure 3-56). 2010 1:16 pm b. specify the prefix (recommended format is connectionName_libraryName_) and select the tables.

under the desired folder. select Report Assistant. 2010 1:16 pm 7214ch03. do not select remote synonym just yet.Include the table in your reports by using a cross-system join: a. complete these steps: i. b. Figure 3-58 Selecting the target database description Chapter 3. DB2 Web Query fundamentals 77 . In the Report Assistant window (Figure 3-58).fm 11. ii. d. In the Web Page Dialog that opens. find and select the synonym for the local table. In the DB2 Web Query home page. Click New. Notice that the Join options page changes. On the Join options tab. click the Join options tab.Draft Document for Review January 3. In the Select from available database descriptions panel. c. find and select the synonym for the remote table and click OK.

and Join fields options. Instances.7214ch03. Figure 3-59 Specifying the join options 78 Getting Started with DB2 Web Query for i . specify the Join Type. Description. 2010 1:16 pm iii. see 5. Note: For more information about joining tables. “Joining tables (reference only)” on page 142. Under Join Settings.fm Draft Document for Review January 3.5. as shown in Figure 3-59.

Draft Document for Review January 3. This was problematic for several reasons: All report developers could see "sensitive" synonyms. the ability to see the names and existence of sensitive synonyms was still an area of concern. Although they could not see the data of the underlying tables. you can finish the report by specifying the desired options such as Sort by and Sum as shown in Figure 3-60. All of the fields from the joined files are displayed in the list of fields to select from. DB2 Web Query fundamentals 79 . Prior to this feature. See Chapter 5. Notice that the fields are color coded to clearly identify the files from which they originated.Click the Field Selection tab. for more details about report writing. At this point. Consequently all synonyms were displayable and selectable from all report development interfaces (across all domains).fm 12. Chapter 3.3 Segmenting and securing Metadata An enhancement that was added to the DB2 Web Query product via a PTF is the ability to segment and secure your metadata.6. There was no way to filter the list of synonyms for specific users or groups of users. The list of synonyms to use when creating a new report could be extensive and finding/positioning to the desired synonym wasn't always easy Promoting reports and their referenced synonyms through the development cycle was tedious because the reports had to be changed (at each step) to reference specific and uniquely named synonyms in BASEAPP. all synonyms were created in the common application folder BASEAPP. 2010 1:16 pm 7214ch03. Figure 3-60 Field selection tab 3. “Report Assistant” on page 97.

and click the right-arrow icon (located between Available and Selected list). Figure 3-61 Create new application Linking an application folder to a domain Once you new application is created you simply create new synonyms in that application folder. Because domains are secured using IBM i group profiles. Select the domain 2. take the following steps: 1. select the desired application folder. To associate the application folder with a specific domain.fm Draft Document for Review January 3. select New Application from the right-click menu as shown in Figure 3-61. This is done by logging into DB2 Web Query Developer Workbench as a user profile that is a member of the MRADMIN group profile and selecting Applications under the Data Servers folder.7214ch03. Once there. 2010 1:16 pm These areas of concern have been addressed with the ability to create custom application folders and associate them with specific domains. Creating an application folder for segmented metadata Creating new application folders to hold your synonyms is a feature provided by Developer Workbench. The application folder (and the synonyms within it) can now be set up as an extension of the domain. 80 Getting Started with DB2 Web Query for i . you now have the ability to segment and secure your synonyms. An example is shown in Figure 3-62 on page 81. From the right-click menu select Domain Properties 3. From the he domain properties dialog. check the Application Path setting.

Draft Document for Review January 3.fm Figure 3-62 Linking the payroll_files application to the Payroll domain After clicking the right arrow icon. Chapter 3. DB2 Web Query fundamentals 81 . An example is shown in Figure 3-63 on page 82. 2010 1:16 pm 7214ch03. the application will move from the Available list to Selected.

you can repeat the above steps and add as many as you want from the list under Available to Selected. 82 Getting Started with DB2 Web Query for i . When you have finished linking the applications to the domain. 2010 1:16 pm Figure 3-63 Linked payroll_files application You can remove applications from a domain by selecting the application under the Selected list and clicking the left arrow icon.500 application folders have been successfully linked during system testing). Note: Although only one application can be selected at a time. However.fm Draft Document for Review January 3. Repeat the above steps to add application webqry01 to the domain. This will move it back to the list in Available. you can sort the Selected list by selecting the application and using the up and down arrow icons above the list. you may want to consider performance implication before adding this many to your domains.7214ch03. Use this technique to move the payroll_files application to the top of the list as shown in Figure 3-64 on page 83. There is no documented limit for the number of application folders that can be linked to a domain (as many as 1. 4. 5.

Draft Document for Review January 3. the Selected list is sorted as shown in Figure 3-65 on page 84.fm Figure 3-64 Move payroll_files to the top After clicking the up arrow icon. Chapter 3. DB2 Web Query fundamentals 83 . 2010 1:16 pm 7214ch03.

and webqry01) any report that references cen_payroll will use the version in the payroll_files application. 2010 1:16 pm Figure 3-65 Linked and sorted applications When DB2 Web Query searches for the synonym specified for a report in this domain.much the same way library list searching works on the IBM i system. The report developers can only reference the synonyms in the application by creating reports from within the domain that the application is linked with. This means that if you have a synonym named cen_payroll in all three selected application folders (payroll_files. Click OK to close the Domain properties dialog window Once you have associated an application folder to a domain. notice that when the Payroll developer logs in using Developer Workbench.fm Draft Document for Review January 3. because it was first in the list.7214ch03. As shown in the example in Figure 3-66 on page 85. you have secured it. baseapp. 84 Getting Started with DB2 Web Query for i . there is no Data Servers option under the system/environment name. it will use the list in the order you have configured . The synonym is only visible and accessible to those developers explicitly authorized to the associated domain or to user profiles that are members of MRADMIN. 7. 6. A developer using DB2 Web Query Developer Workbench tool can only access the Application folders by going through the domain. Accept the settings by clicking the Apply button.

DB2 Web Query fundamentals 85 . If you do not see a domain that you need. and are logged on to the DB2 Web Query home page. Before you continue. we explain how to run a report.7 Basic user The basic user employs DB2 Web Query to run reports. “Logging in” on page 29. You only see the domains to which you are authorized. 2010 1:16 pm 7214ch03. the developer must expand Domains → Applications.4.fm Figure 3-66 DB2 Web Query Developer Workbench interface for developers The Data Servers option is only available for members of MRADMIN. In order to work with application folders (and the synonyms within them). contact your DB2 Web Query administrator. so in this section.Draft Document for Review January 3. The only applications that appear in this list are the ones that have been linked to the domain. This way the developer can only access synonyms in the application folders linked to the domains that he or she is authorized to. Chapter 3. 3. ensure that you have read 3.

ask your developer to limit the number of records that are returned to you. If your report returns several thousands of records. expand the domain. Then the results are displayed in the right panel (see Figure 3-67). Then expand the Reports folder and the subfolder.7214ch03. “Sum and detail reports” on page 102. After you expand the subfolder. 2010 1:16 pm To run a report.fm Draft Document for Review January 3.2. The subfolders inside of this report categorize the reports within the domain.3. Figure 3-67 Running a report Keep in mind that the results of your report are returned to your PC and stored in your browser. 86 Getting Started with DB2 Web Query for i . We explain how to do this in 5. The Processing Request panel is displayed while your results are retrieved from the server. If you think the report returns more records than you can use. you will notice more delay than if your report returns ten records. This affects the time that it takes for your results to appear. double-click the report that you want to run.

“Power Painter” on page 197 Chapter 4. are structured as basic tutorials. These examples are not intended to replace reference manuals or customer education classes. © Copyright IBM Corp. Specifically we use the following tables: ORDERS INVENTORY PLANT STORES ORDERS is the central table. In Chapter 4. you can go straight to Chapter 5. This library can also be referenced as the “Century” library. lays the groundwork for the following tutorials.Draft Document for Review January 3. The intent is to provide hands-on exercises that help you get started and demonstrate the more common reporting techniques. This part includes the following chapters: Chapter 4. Century is the fictitious electronics company that is referenced throughout these tutorials. you will see that we only directly refer to the ORDERS table. “Report Assistant” on page 97 Chapter 6. 87 . “Getting started with the tutorials” on page 89. It contains foreign keys or links to the other three tables. All rights reserved. 2010 1:16 pm 7214p02. Thanks to the knowledge and understanding that DB2 Web Query has DB2 for i5/OS. the other three tables are automatically made available whenever ORDERS is referenced. The tutorials all use tables in the QWQCENT library. In our examples. “Tutorials for DB2 Web Query optional features” on page 227. 2009. “Getting started with the tutorials” on page 89 Chapter 5. “Report Assistant” on page 97. “Graph Assistant” on page 151 Chapter 7.fm Part 2 Part 2 Tutorials for DB2 Web Query This part and Part 3. See the following figure. “Getting started with the tutorials” on page 89. If this has already been done for you. we explain the tables that we are going to use in future chapters and set up security.

PlantCode is the key to the PLANT table. the following foreign keys are defined in the ORDERS table: ProductNumber is the key to the INVENTORY table. 88 Getting Started with DB2 Web Query for i . StoreCode is the key to the STORES table. 2010 1:16 pm Map of tables in QWQCENT .fm Draft Document for Review January 3.Century library In DB2 for i5/OS.7214p02.

such as the security. 89 . We explain many of the steps in this chapter in more detail in Chapter 3. “DB2 Web Query fundamentals” on page 25.Draft Document for Review January 3. Getting started with the tutorials In this chapter.fm 4 Chapter 4. 2010 1:15 pm 7214ch04SetupTutorials. we set up the System i platform and the user profiles in preparation for the tutorials that follow. © Copyright IBM Corp. domains and Hrefs. All rights reserved. For more understanding behind items. refer to Chapter 3. step-by-step instructions and to enable the tutorials to stand alone. They are included here to give you complete. “DB2 Web Query fundamentals” on page 25. 2009.

point your browser to the following URL (Figure 4-1): http://systemi_name:11331/webquery Figure 4-1 URL to initiate DB2 Web Query 5. Enter your System i user ID and password (Figure 4-2 on page 91). Open a browser. 90 Getting Started with DB2 Web Query for i . Incorporate the user profile to a group profile called MDUNTITLED. you are authorized to create new reports in the default Common Domain.3. MRADMIN group: Being a member of the MRADMIN group instead of MDUNTITLED also works for these tutorials. For more details about security and authorizations. Finally you must define all the tables that we will query to DB2 Web Query through the Create Synonym process. but use Internet Explorer for the tutorials presented in this book. Since DB2 Web Query uses port 11331.fm Draft Document for Review January 3. “Registering named users” on page 28. Enter the following command: CALL QWEBQRY76/WQADDLIC ‘USERPROFILE’ USERPROFILE references your System i user profile name and must be specified in uppercase letters. 2. 2010 1:15 pm In preparation to start using the tutorials. Note: You can also use the CL Command ADDWQLUSR for the same purpose. When you install DB2 Web Query. Before you start using the tutorials. see 3.5. register your user profile as a valid licensed DB2 Web Query user. you must be a member of either MDUNTITLED.3. 1. you must authorize your user profile to create tables in the Common Domain. see 3.7214ch04SetupTutorials. For more details about registering and removing users. The MRADMIN group profile allows a user to create new reports in all domains and to create new domains. 3. As a member of the MDUNTITLED group. Then you must create a folder to store all your work. This additional authorization is not required for the tutorials. “Assigning authority to users” on page 35. To create reports in the Common Domain. the system creates a group profile named MDUNTITLED. 4. We tested these steps using both Internet Explorer and Firefox.

2010 1:15 pm 7214ch04SetupTutorials. One of the properties is the Href or the system identifier. right-click Common Domain and select Properties to see the domain properties.Draft Document for Review January 3. right-click the Reports folder. In the main DB2 Web Query home page. and select New Folder. For the Common Domain. Close this window. this is always “untitled”. Chapter 4. The Common Domain is where we store our reports. Getting started with the tutorials 91 . Expand Common Domain. 9. which is where we store all of our work. Figure 4-3 Common Domain properties 8. In the New Folder window (Figure 4-4). you now have developer authority (MD) in the domain UNTITLED. By previously including yourself in the group MDUNTITLED. The Domain Properties window (Figure 4-3) opens.fm Figure 4-2 Initial logon window 6. 7. create a new folder called Tutorials. Click Save.

92 Getting Started with DB2 Web Query for i . you must tell DB2 Web Query which tables the users can query.Before you can create a report on the System i machine. right-click Tutorials and select Metadata. it is available system wide and to all reports.In the Data Adapters window (Figure 4-6).7214ch04SetupTutorials. and select Create Synonym. right-click *LOCAL. which is the System i where the table resides. In the left navigation area (Figure 4-5). the metadata is not restricted to that folder. 2010 1:15 pm Figure 4-4 Creating a new folder 10. For more details. After the metadata is created. DB2 Web Query then creates the metadata or synonyms to describe the selected tables. see “Creating metadata” on page 47. Figure 4-5 Creating metadata 11. Note: Although you select a folder to enable the submenu that contains metadata.fm Draft Document for Review January 3.

This leaves us with a concise list that contains only our physical files or tables. These additional databases must be defined in the relational database directory table on the System i machine. The library that we use throughout the tutorials is the QWQCENT library. select the Tables option.Draft Document for Review January 3. selecting Views also displays all of the SQL catalog views in the library. d. Chapter 4. you can add a connection to these systems. Click Next. For Restrict object type to. 2010 1:15 pm 7214ch04SetupTutorials. database optimizer (Classic Query Engine (CQE)). type qwqcent. DB2 Heritage files refers to older tables that have multiple record types or multiple members. logical partitions (LPARs). Any of these remote DB2 tables are then available for use. Under Further restrict search to:. you must leave Views selected. complete these steps: a. In this example.fm Figure 4-6 Creating a synonym Tip: If you have other System i machines. or independent auxiliary storage pools (IASPs) in your network. and Other Objects. 12. SQL views: If you created SQL views or logical files and want to query them. Then the database names will be displayed under *LOCAL. Query/400 imports the existing Query/400 definitions and converts them to both table and report definitions. specify Tables. c. Getting started with the tutorials 93 . If this library is an SQL collection or schema. we clear the Views check box. It then directs the query to the older. 13. b. Note: There are three types of System i objects that you can query with the base DB2 Web Query product.In the Select Synonym Candidates on DB2 cli pane (Figure 4-7). For Library.Enter the library where the tables reside. and typically slower. Tables described with this adapter use the OPNQRYF command on the System i machine. Views. DB2 cli refers to the majority of your tables created with either an SQL CREATE TABLE statement or by using data description specifications (DDS) and a CRTPF command.

see “Referential Integrity” on page 56. If you have a long list of table names. This prefix is added to the beginning of the table names. For more details about foreign key support. Click the Create synonym button. using a prefix is one way to keep all related tables grouped together. Select With foreign keys to bring in all tables that are directly related through referential integrity and foreign key support. 2010 1:15 pm Figure 4-7 Select Synonym Candidates for DB2 cli pane 14. select the check box next to Default synonym name to select all the tables that are currently displayed. b. complete these steps: a. enter Cen_. c.fm Draft Document for Review January 3. 94 Getting Started with DB2 Web Query for i . Cen_ALERTS. In the list of tables.7214ch04SetupTutorials. For Prefix. d.In the Create Synonym for DB2 cli pane (Figure 4-8). for example. so the users see. and so on. CEN_ORDERS.

See Figure 4-9. Figure 4-9 Synonym creation completion Chapter 4. Getting started with the tutorials 95 .Draft Document for Review January 3. You have created a folder to store all your work in called Tutorials. You have also defined all the tables that we query to DB2 Web Query through the Create Synonym process. 2010 1:15 pm 7214ch04SetupTutorials.fm Figure 4-8 Creating QWQCENT metadata You have now authorized your user profile to create tables in the Common Domain.

2010 1:15 pm 96 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3.7214ch04SetupTutorials.

which is for users who are not connected to a System i machine. Report Assistant’s tight integration with Excel includes the real-time creation of Excel spreadsheets with full styling. © Copyright IBM Corp. and online analytical processing (OLAP)-enabled reports are both based on existing reports that are created in this chapter. include record selection criteria. footings. 2010 1:16 pm 7214ch04. When you use Report Assistant. subtotals. apply a style template.fm 5 Chapter 5. This support allows Excel power users to analyze their corporate data in a tool with which they are already familiar. graphical interface with drag-and-drop functionality. For more details about the various options that are not discussed in the tutorials. With DB2 Web Query. 97 . 2009. Microsoft Excel. drill-downs. In this chapter. It enables you to quickly create a report in which you can sort data. and more.Draft Document for Review January 3. and DB2 database files. you can specify input parameters to allow users to easily subset or filter their reports. you will find the help text to be more extensive than the help text that is available in Report and Graph Assistant. Tip: If you have Developer Workbench installed. Many of the reports created in this chapter are prerequisites for the enhanced features that are discussed later in this book. and page breaks. use the help text. add headings. and formula capabilities. Report Assistant supports output in many different file types including PDF files. Active Reports. All rights reserved. DB2 Web Query creates a styled report that you can deploy on the Web without learning the complexities of any reporting language. we go into detail about basic functionality that is common among the various DB2 Web Query components. Report Assistant Report Assistant provides an intuitive.

In this section.7214ch04.1 Tutorial overview In this tutorial.fm Draft Document for Review January 3.5. We use the Century database that ships with DB2 Web Query in the QWQCENT library. “Getting started with the tutorials” on page 89. The second report is a more detailed report that calculates gross profit for each product category within a specific user-requested product type. You can find instructions for creating the metadata that defines this database to DB2 Web Query in Chapter 4. we create the two reports. 2010 1:16 pm 5. you must have read and completed the steps in Chapter 4. which are shown in Figure 5-1. we show the product revenue for each product type. Finally we enable a user who is viewing the initial summary report to click the product type and automatically drill down to see the more detailed gross profit report. we illustrate how to perform the following tasks among others: Define a report layout Apply date formatting Use selection criteria Define traffic lighting Generate subtotals and report headings 98 Getting Started with DB2 Web Query for i .2 Report creation In our first task. Figure 5-1 Final drill-down reports 5. Important: In order to complete the tasks in this chapter. This section is for your reference only and is not part of the tutorial. “Getting started with the tutorials” on page 89. we demonstrate how to join two tables if you did not previously define the relationship using DB2 foreign key support. As we explain how to create this report. The first report is a simple summary that shows revenue by product type. In 5. “Joining tables (reference only)” on page 142. we explain how to create a summary and detailed report.

Select the CEN_ORDERS table. 2010 1:16 pm 7214ch04.Draft Document for Review January 3. Continue with the next section to learn how to use these names to define a report layout. which is where you will store your report. Right-click the Tutorials folder. when you define your tables (create synonyms) to DB2 Web Query. Note: Depending on the number of tables that were defined previously to DB2 Web Query.2.fm 5. for example by subject area. collection. and select Report Assistant. you jump to the tables that start with that character. These tables are automatically brought in by DB2 Web Query Chapter 5. 5.2 Defining a report layout As discussed in “Referential Integrity” on page 56. 2. As shown in the example in Figure 5-2. you add a prefix to the tables so that they are logically grouped. you see a list of available tables for you to query. In the Reports navigation area. you can tell from the word Cluster in the description that this single definition covers multiple tables without requiring external joins. expand Common Domain → Reports. or library. Report Assistant 99 . you see a list of all the column or field names on the Field selection tab.2. the displayed fields in the Available fields list come from various tables. Click OK.1 Creating a summary report (RA1_Revenue) To begin creating a summary report: 1. under Domains. We recommend that. Tip: When you type the first character of the table name. In the window that opens. Figure 5-2 Initial table selection using Report Assistant After you choose the CEN_ORDERS table. your list might contain only one table or it might contain many tables.

Icons for Available fields: You can choose to view your field names alphabetically regardless of which table they originated from. Again from the list of available fields.7214ch04. To define a report layout: 3. and so on. you must highlight the column in which you want to insert in your report and then click the add field icon in the appropriate pane. you might not be able to drag your fields. 4. Sum. Select the Add grand totals to the end of the report check box. which shows the fields within each individual table. This results in the composite list of available fields. drag PRODUCTTYPE to the Sort by pane in the center of the window. 2010 1:16 pm when you select the Foreign key option during the creation of the Orders synonym or metadata. LINETOTAL is the gross revenue for each line item on an invoice. for example Sort by. In this case. Tip: If you are using the Firefox browser. From the list of Available fields on the left. The second icon is the dimension or hierarchy icon. The first from the left is a calculator icon. Immediately above the field list are three icons. Figure 5-3 Report Assistant field selection 100 Getting Started with DB2 Web Query for i . drag LINETOTAL to the Sum/Print pane on the right side of the window.fm Draft Document for Review January 3. The third icon is the list icon. which shows all the fields from all the tables in one long alphabetical list. 6. See Figure 5-3. or you can view the fields for each table separately. To see the table or segment names. to where you want to move the field. 5. drag the sides of the window to widen it.

b. Chapter 5.Draft Document for Review January 3. 8. Figure 5-5 Report Assistant save as menu It was easy to answer the question that was posed about the total revenue by product type. Save the report as shown in Figure 5-5: a. but we know that we can make this report look better and more meaningful for the users. Figure 5-4 Initial Summary Report Tip: If you use an alpha field instead of LINETOTAL. the default sum option shows the value of the alpha field in the last record for each sort group or product type. Click the Save button at the top of the window and select Save As. 2010 1:16 pm 7214ch04. Report Assistant 101 . In the Save Standard Report window. enter the name as RA1_Revenue and click OK. click the Run arrow to run your first report.fm 7. At the top of the window. Figure 5-4 shows the initial summary report. Next we take a closer look at creating sum and detailed reports.

limit the number of records that you want to read. we click the Sum button.Click Print instead of Sum. 11. 102 Getting Started with DB2 Web Query for i .3 Sum and detail reports In this section. There are more than 32. type 100 for the number of records to read.Click the Field selection tab. By default.2. Under Content and generation. The Print option turns off the aggregation and produces a detail report.7214ch04. As requested. Before you run a detail report. 2010 1:16 pm 5. which we used to produce the initial summary report. this report was aggregated on PRODUCTTYPE. Figure 5-6 Limiting the records to read on the Report options tab 10. b. a.fm Draft Document for Review January 3. Click the Report options tab (Figure 5-6). we look at the difference between the Sum and Print options on the Field selection tab. We do not need to retrieve all of these records simply to make a point.000 detail records in the orders file. for the Limit the number of read operations performed during report generation field. 9.

minimum. click Sum. On the Field selection tab.fm 12. Figure 5-7 Report Assistant detailed print report 13. The Sum option sums or aggregates field values that are based on your sort column and consolidates the records. You can specify if you want the report to display the actual data in a field or if you want to see the average.The Print option is for a detailed report that includes one row for each selected record.Draft Document for Review January 3.We now enhance the report to make it more readable: a.LINETOTAL arrow near the bottom of the window.Click the Run arrow at the top of the window. 14. or maximum value in the field instead. b. for the Limit the number of read operations performed during report generation field. On the Report options tab. Report Assistant 103 . Click to highlight the LINETOTAL field in the Sum/Print pane.Field options . Select the Show . complete these steps: a. Click the Report options tab. The Field options display allows you to work with the properties for an individual field. 2010 1:16 pm 7214ch04. Since we want a summary report. clear the value of 100. If Chapter 5. b. You can set up a field so that when a user clicks on it they will drill down to a lower level report. You can describe standard and conditional formats based on values in your report. Then you see the report shown in Figure 5-7. c.

. add ranking columns.7214ch04. 2010 1:16 pm you are working with a sort field you have additional capabilities to control the sort. Figure 5-8 Report Assistant field options ii. Figure 5-9 Report Assistant change format window 104 Getting Started with DB2 Web Query for i .. i.fm Draft Document for Review January 3. Click the ellipsis or three dots (.) button under the Format in report as field (Figure 5-8). select Commas inclusion and Floating dollar to change the LINETOTAL field to be displayed with commas and a floating dollar sign. and control the subheadings and subfooting. Under Select options (Figure 5-9).

iii. more meaningful column headings for users. 2010 1:16 pm 7214ch04. DB2 Web Query imports the DB2 heading attribute into the metadata attribute Title. Click the Title tab. In our case. Ensure that LINETOTAL is highlighted. Figure 5-10 Report Assistant new column headings Chapter 5. complete these steps: i. This pane is where you enter your own. Report Assistant 105 .fm c. On the Field selection tab.Field options arrow. ii. Select the Show .Draft Document for Review January 3. See Figure 5-10. Notice that the title is Revenue. the LINETOTAL column was defined to DB2 as having a heading of Revenue.

click the ellipses (. Click the Title tab. 106 Getting Started with DB2 Web Query for i . Figure 5-11 Report Assistant field calculation options iii. select Count. Click the Show . Note: If you do not see a long list of field options including Count. i. Drag ORDERNUMBER from the Available fields list on the left to the Sum/Print pane on the right. 2010 1:16 pm 15.Add a count of the number of orders for each product type: a. Verify that Sum is highlighted.7214ch04. The value is displayed in the field as I7C. Change the field format to integer seven with commas. Under the Format in report as field (Figure 5-11)..Field options button to open the pane if it is closed..fm Draft Document for Review January 3. ii.) button. and not Print. Under Calculated as. verify that your report is a summary report and not a detailed report. b.

Draft Document for Review January 3. Figure 5-12 Report Assistant column heading for count field Chapter 5. Report Assistant 107 . 2010 1:16 pm 7214ch04. with Order on the first line and Count on the second line. Change the heading as shown in Figure 5-12.fm iv.

move CNT. Figure 5-13 Report Assistant field count 16.Save your report. Figure 5-14 Report Assistant RA1_Revenue report 17. 108 Getting Started with DB2 Web Query for i . Using the up and down arrows (circled on the right in Figure 5-13) in the Sum/Print pane.7214ch04. You have now created a report that includes a count of the number of orders for each product type.Click the Run arrow at the top of the window to run the report.fm Draft Document for Review January 3. 2010 1:16 pm c. Figure 5-14 shows the results of running this report.ORDERNUMBER above LINETOTAL.

1. If you closed your report.4 Date formatting (RA2_XTab) In this next example. 3. we select only products that were sold in the year 2007. b. For Format. and the other field contains the year. See 12. 2010 1:16 pm 7214ch04.Draft Document for Review January 3. and across the top of our report.1. which explains how to modify the metadata and make these fields available globally. This task requires you to have the optional Developer Workbench feature. “Date Decomposition” on page 348. d. Next to the Field selection list.1. on the DB2 Web Query home page. either select or type ORDERDATE. Report Assistant 109 . select Q. Note: The new quarter and year fields will be available only in the current report.fm 5. One field contains the quarter. In the date field. We create two new fields based on ORDERDATE. open the Tutorials folder. 2. and select Open. we add the quarter in which the products were sold. complete these steps: Figure 5-15 Report Assistant defining a date quarter Chapter 5. c. The name must be in uppercase letters. In the Define field creator window (Figure 5-15).2. right-click the RA1_Revenue report. This extracts the quarter data from ORDERDATE. Enter the name of the field as Quarter. Click OK. ) to define a new field. click the calculator icon ( a.

Figure 5-16 Creating a date year field Note: DB2 Web Query handles dates in an intelligent manner. much of this information. Repeat the process starting with step 2 on page 109 to create the year field.5 Selection criteria In this section. On the Selection criteria tab (Figure 5-17 on page 111). including the various date formatting options. For Format. For this reason. from the Available fields list. type Year. 5.7214ch04. is not well described in the help text. 110 Getting Started with DB2 Web Query for i . 6. However. for fields.fm Draft Document for Review January 3. we provide details about working with dates in “Date and time system variables” on page 514. In the Define field creator window (Figure 5-16).2. we continue the procedure by filtering this report and selecting only the year 2007: 5. either select or type ORDERDATE. 2010 1:16 pm 4. select YY. In the date field. Click the Selection criteria tab. drag Year to the white pane on the right.

and aggregated. If you use WHERE. WHERETOTAL does the comparison after the records are retrieved. Figure 5-17 Report Assistant Selection criteria Chapter 5. For example. WHERE does the select at read time and only passes those records to the query that meet the specified condition. DB2 Web Query allows you to choose WHERE or WHERETOTAL. if you want to select only the product types whose total revenue was greater than $100 million. 2010 1:16 pm 7214ch04. you apply the selection on every individual order read and none meet this criteria. 8.Draft Document for Review January 3. 9. The selection is done on the aggregate value of the column. Click Select values. sorted. From the first drop-down list.fm 7. Select EQUAL to. you use WHERETOTAL. select WHERE. WHERE or WHERETOTAL: Although we select the default WHERE. Report Assistant 111 .

customers. you can browse your local PC. DB2 Web Query looks for all distinct values in this field and presents them in a list. you can store a list of products. 2010 1:16 pm 10.7214ch04. Note: You can compare a field to the following types: Constant Parameter Field Values c. If you click the wizard icon ( ) next to the Constant prompt.fm Draft Document for Review January 3. 112 Getting Started with DB2 Web Query for i . A specific number A variable whose value or values are either entered by a user or passed from another report Another field in your table or tables Selectable from a list of actual values in the selected field Figure 5-18 Report Assistant selection values Tip: With DB2 Web Query. regions. complete these steps: a.In the window that opens (Figure 5-18). b. This list can be stored in a text file or in Excel. and so on that you are specifically interested in on your local PC. Click OK. The values in that file then become the filter for your query. Select 2007. Click the Values radio button.

Draft Document for Review January 3. drag Quarter to the Sort across pane on the right side of the window (Figure 5-19). 2010 1:16 pm 7214ch04. Report Assistant 113 . You see the results as shown in Figure 5-20.Click the Run arrow at the top of the window to run your report.6 Cross-tab report (RA2_XTab) In this section. Figure 5-20 Report Assistant sort across output Chapter 5. Figure 5-19 Report Assistant Sort across 12. we continue our report creation process by creating a cross-tab report: 11.2.fm 5.From the Available fields pane.

7 Creating a sample detail report (RA3_GP) In this section. 13. Figure 5-21 Report Assistant file selection 114 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. 1.2. 5. We are also able to drill directly to this report from the RA1_Revenue report that we initially created. In the window that opens (Figure 5-21). Right-click the Tutorials folder and choose Report Assistant. the product type that they want to query. at run time. In the Save Standard Report window. and close it. 2010 1:16 pm Tip: If your report shows only two quarters. click Save → Save As. select the CEN_ORDERS table and click OK.7214ch04. See step 13 on page 103. remember that you must remove the 100 record limit. save the report with the name RA2_XTab. we create a parameterized report where the user selects. 2. click OK.At the top of the window.

In this case. and select New define field (Figure 5-23 on page 116)..Field options. Note: There are two ways to create calculated fields in DB2 Web Query. Drag LINETOTAL and COSTOFGOODSSOLD to the Sum/Print pane. for Format in report as. 5. 4. Select the Add grand totals to the end of the report check box. Under Hide . 6. Figure 5-22 Report Assistant Field selection for detail report Defining and computing fields In this section. click the ellipsis (. You can use this icon to create a compute field. Report Assistant 115 .Draft Document for Review January 3. Add commas to the formatting of LINETOTAL and COSTOFGOODSSOLD. Compute fields are often required for percentages and variances. We create a gross profit field by subtracting the COSTOFGOODSSOLD from LINETOTAL. drag PRODUCTTYPE and PRODUCTCATEGORY to the Sort by pane (Figure 5-22). we create new fields and explain how to create new calculated fields in our report: 7.) button. This field is calculated every time a record is read and selected. Chapter 5. which is next to the Available fields heading. From the Available fields pane. you add the definition to the list of fields within the table. Next to the Sum/Print heading is the wizard wand icon.fm 3. Click the calculator icon ( ). When you use the define field. 2010 1:16 pm 7214ch04. the field is not calculated until after the data is sorted and all aggregation is complete..

fm Draft Document for Review January 3. The function icon is used to display the precoded functions that are available. There are three icons on the right side: . 2010 1:16 pm Figure 5-23 Report Assistant New define field 8. Click the Format button and define your field as being an integer. Create the formula LINETOTAL . Tip: Field names in the Defined field creator panel must all be in uppercase. Double-click the field LINETOTAL. ). Figure 5-24 Report Assistant creating a defined field 116 Getting Started with DB2 Web Query for i . with commas and a floating dollar sign. It is displayed in the field as I10CM. complete the following steps: a. b.COSTOFGOODSSOLD. This icon shows the list of available field names c.7214ch04. d. 10 long. and then double-click COSTOFGOOD. In the Define field creator window (Figure 5-24). Enter a new field name of Gross_Profit. The first two icons display the list of fields in various formats including alphabetically and hierarchically. click the minus button (-) on the calculator pad or on your keyboard. Click the list icon ( alphabetically. Try the different buttons.

Report Assistant 117 . a. dollar sign. Click OK. see Appendix C. The define field must exist before it can be used in a secondary calculation.Draft Document for Review January 3. Drag your new Gross_Profit field to the Sum/Print pane (Figure 5-25). b. 10.Field options arrow near the bottom of the window. Change the column as shown in Figure 5-26.Click the Show . Figure 5-26 Report Assistant Show .Field options Chapter 5. “Processing differences between the define and compute fields” on page 563. ensure that the field length is large enough to handle the commas. e. Figure 5-25 Report Assistant formatting gross profit Tip: There are times when you might create one define field based on a second define field. Select the Title tab. 9. 2010 1:16 pm 7214ch04. DB2 Web Query processes the defines in the order in which they are entered into the system.fm Tip: When creating your own reports. Verify that the Gross_Profit field is highlighted. and maximum digits possible. with Gross on the first line and Profit on the second line. For more details about viewing the define order of the fields.

aliases. DB2 Web Query uses them. highlight Gross_Profit and open the Field options pane. Click the Conditional styling button. 12.fm Draft Document for Review January 3. Figure 5-27 Report Assistant Conditional styling option b. or column headings. you can create a virtual field and use the formula: IF Year EQ 2007 THEN 1 ELSE 0 DB2 Web Query prefers using “EQ” instead of “=”.In the Sum pane.000. 2010 1:16 pm If you define your DB2 tables and specify long names. click the wizard icon.000 or more: 11. Tip: The IF THEN ELSE constructs allow you to use logic when creating virtual fields. For example.8 Conditional styling (traffic lighting) Next we highlight the gross profits that are $25.Select the Display tab (Figure 5-27): a.7214ch04.2. 5. In the Conditional styling window (Figure 5-28). Figure 5-28 Report Assistant Conditional styling window 118 Getting Started with DB2 Web Query for i . if you want to create your own count of the number of items sold in 2007.

Click OK. in a high profit situation. That was the column that we started with when we clicked the Conditional styling button (Figure 5-30). v. You can create one condition and attach it to multiple columns. Report Assistant 119 . From the list of conditions. For Relations. This allows you to monitor your report and present the high and low in different colors.Draft Document for Review January 3. High_Profit. Enter the name High_Profit for this condition. If you click the Values button. Figure 5-30 Report Assistant attach conditional styling Chapter 5. For example. In the Edit condition window (Figure 5-29). and then click the add icon on the right side of the window to attach the condition to the Gross_Profit column. Figure 5-29 Report Assistant edit condition window You can now enter another condition. For Field. highlight the one in which your are interested. enter a value of 25000000 (25 million). select your test field of Gross_Profit. ii. Values button: The Conditional styling dialog allows you to compare Gross_Profit to another field in your table. iv. Under Please select a value. you might want every column in the report to be highlighted. d. you see a list of distinct values in the Gross_Profit column.fm c. Note: Now that you have created a condition. iii. you can define various filters or conditions for which you want to test your data: i. select the is greater than or equal to relationship. For example. you might want to create a condition called Low Profit. 2010 1:16 pm 7214ch04. you must “attach” it to your column for it to take effect.

we explain how to enhance our report by using variables in the report headings and in page footing: 14. To make the profit stand out. 2010 1:16 pm 13. For Page footing.9 Using variables in report headings and footings In this section. see “Date and time system variables” on page 514.2.Click the Report headings tab.Under Page heading. Click OK twice to return to the main reporting window. type Prepared on &DATE at &TOD (Figure 5-32). b.fm Draft Document for Review January 3. enter Gross Profit by Product Category. Click the Font button. 15.7214ch04.Define the formatting of the Gross_Profit field when it meets the High_Profit condition. Figure 5-31 Report Assistant styles window 5. 120 Getting Started with DB2 Web Query for i . a. highlight it by choosing the Bold style and green for the background color (Figure 5-31). Tip: For more information about using date and time variables within DB2 Web Query.

Draft Document for Review January 3. Report Assistant 121 . To control the report formatting yourself. Chapter 5. you must remove the default style sheet under the Report options tab. 16.fm Figure 5-32 Report Assistant page headings and footings Note: DB2 Web Query ships with a default style sheet that automatically formats headings and footings.Click Run at the top of the window to run your report. Figure 5-33 shows the resulting report. Notice how easy it is to see the high profit items that are highlighted in green. 2010 1:16 pm 7214ch04.

Click the Save button at the top of the window and select Save As.7214ch04. 2010 1:16 pm Figure 5-33 Report Assistant high profit report 17.fm Draft Document for Review January 3. 122 Getting Started with DB2 Web Query for i . enter the name it RA3_GrossPft and click OK. In the Save Standard Report window.Save your report.

b. a. Figure 5-35 shows the results of running this report.Field options pane (Figure 5-34) is displayed.Draft Document for Review January 3. Figure 5-35 Report Assistant subtotalled report Chapter 5.Make sure that the Show .fm 5. Click the Sorting tab.2.In the Sort by field.10 Generating subtotals We continue our example by generating subtotals for each product type: 18. Report Assistant 123 . Figure 5-34 Report Assistant subtotals 20. highlight PRODUCTTYPE. 2010 1:16 pm 7214ch04. 19. Select Subtotal numeric sum/print fields.Click the Run arrow at the top of the window to run your report again.

fm Draft Document for Review January 3.Under Current Subtotal Text. You can override individual columns and request that. instead of summing the column.Click the Run arrow to run the report. 24. Figure 5-37 Report Assistant report showing new subtotal headings 124 Getting Started with DB2 Web Query for i . 2010 1:16 pm 21. make sure that PRODUCTTYPE is highlighted. all columns are summed to create a total line. 23. Make sure that you leave a blank at the end because DB2 Web Query appends the product type to your heading. the total line should show the result of calculations such as a count of values or the average of the values.In the Field options pane.To change the default subtotal heading. 22.7214ch04. Figure 5-36 Report Assistant new subtotal headings Tip: By default. Figure 5-37 shows the results of running the report. type Subtotal for. click the new Subtotal tab (Figure 5-36). Look at the options under Sum.

2010 1:16 pm 7214ch04.In the Show . 26. you will work with individual gross profit records instead of the aggregate or total of gross profit by product type. Figure 5-39 Report Assistant make field invisible Chapter 5. click the Sorting tab and select the Total option.Field options pane for Gross_Profit does not contain a Sort tab.The Show . your report contains the Gross_Profit column twice. If you do not perform these steps. Then move it below PRODUCTTYPE as shown in Figure 5-38. Select the Display tab and click the Make this field invisible option to make Gross_Profit invisible (Figure 5-39). the user now requests that we sort by gross profit within product type: 25. Figure 5-38 Report Assistant adding additional sort criteria Tip: If you run your report without selecting the Total option.Field options pane.11 Sorting by an aggregate field Often when users see the results of what they requested. you see that the report contains detail records instead of summary records.fm 5. Report Assistant 125 .Draft Document for Review January 3. 27.If you do nothing else. Instead of a product category within a product type sequence.2. it is important to remember to select the Total option. Drag Gross_Profit from the Available fields pane to the Sort by pane. Therefore. they want something different.

highlight Gross_Profit. select the Add Ranking column.In the Sort by pane. 2010 1:16 pm 28. 32.Click the Ranking tab. Figure 5-40 shows the results of running the report. 29.Click Show .Field options if it is not in view. Profit on the second line.Click the Run arrow to run the report. 33. and Rank on the third line. 34.12 Adding ranking columns (RA4_Advanced) We now show the gross profit ranking within the product type: 31. Change the column as shown in Figure 5-41. Figure 5-41 Report Assistant ranking 126 Getting Started with DB2 Web Query for i .Save your report.fm Draft Document for Review January 3. Figure 5-40 Report Assistant sorting by a sum field 5. 30.On the Ranking tab. Notice that the records within each product type are in descending sequence by gross profit instead of product category.2.7214ch04. with Gross on the first line.Click the Sorting tab and select the Descending sequence.

Draft Document for Review January 3.fm 35. use the ranking capability. Tip: If you want to produce a “Top 10” report.Click the Run arrow at the top of the window to run your report. you limit your ranked values to 10. Figure 5-42 Report Assistant with a ranking column 5. Chapter 5. right-click the RA4_Advanced report and select Open. 36. we experiment with a few of the other Report options within DB2 Web Query. enter the name it RA4_Advanced and click OK. 2010 1:16 pm 7214ch04. If you must open this report. Click the Save button at the top of the window and select Save As.Save your report. on the DB2 Web Query home page. The first one is on-demand paging. the RA4_Advanced report must be open. From the Ranking tab. In the Save Standard Report window. Figure 5-42 shows the results of running the report. To continue with this section.3 Output options In this section. Report Assistant 127 .

fm Draft Document for Review January 3. Assume that our report was 201 pages long instead of one page long. 2010 1:16 pm 5. Figure 5-43 Report Assistant On-demand paging option Our sample report is not the best to show the on-demand paging feature.7214ch04. When on-demand paging is enabled. See Figure 5-43. but you can see the options that are available with on-demand paging as shown in Figure 5-44. DB2 Web Query saves your report on the System i machine and delivers one page of report output at a time to your browser. On-demand paging allows you to jump directly to a specific page or to search for a string of information in the report. Then rerun your report. On this tab. Jump Next page Search Figure 5-44 Report Assistant On-demand paging output 128 Getting Started with DB2 Web Query for i . decreasing the amount of time that you wait for your report to be transmitted. select the On-demand paging option. The bulk of your report remains on the System i machine until you request it or close the report.1 On-demand paging Choose the Report options tab.3.

See “I have my own style sheets that I want to use for my reports. If your PDF report scrolls onto two pages. you run into a known problem with the default style sheet. Not all style sheets have this problem. Report Assistant 129 . How do I make them available from Report Assistant?” on page 491.sty” style sheet that ships with DB2 Web Query. select PDF . In this section. Figure 5-45 Report Assistant PDF report options Restriction: The report shown in Figure 5-46 was generated using an imported style sheet.3. 2010 1:16 pm 7214ch04. This FAQ includes information about how to import style sheets. DB2 Web Query provides many additional options for output. Adobe Acrobat Professional Edition is also not required. The report in Figure 5-46 was created using the “problue.fm 5.2 PDF output Up to this point. Then click the Run arrow to generate the report again. Figure 5-46 Report Assistant PDF output Chapter 5. For Generate report as. no additional software is required other than the no-charge Adobe Reader®. Click the Report options tab.Portable Document Format (Figure 5-45).Draft Document for Review January 3. This problem is being investigated as this book goes to print. all of our output has been to a browser. Note: To create a PDF report. we look at the PDF output option.

Excel binary (XLS) files. Note: There are many more output choices. style sheets can be applied. the difference between HTML and HTML with grid is whether your reports shows with grid lines between the rows and columns. Excel 2007 can read the Excel 2000 format. This option is overridden by your style sheet. You should still be in report RA4_Advanced. referred to as Excel 2000. cells can be formatted. as well as many compute fields. However. Select Excel w/formula from the first drop-down list.fm Draft Document for Review January 3. and the newer XML-based Excel format (XHT). Click the Report options tab. referred to as Excel 97. Excel 2000 is really the first release that supported XML. your totals and subtotals. 3. are represented as Excel formulas and are not downloaded as static values. This allows these columns to continue to be accurate even after the user modifies the worksheet. DB2 Web Query cannot output directly in the new format of Excel 2007. Run your report. With this choice. traffic lighting or conditional styling can be passed. and drill-downs are supported from within the resulting spreadsheet. complete with formulas. calculations can be rendered as formulas. If you are not using a style sheet for your output. 2.3 Excel output There are multiple choices for outputting to Excel. With the XML-based Excel 2000. Excel 97 versus Excel 2007: DB2 Web Query has the ability to create reports as Excel files. Changing the second drop-down list changes the output choices in the first list. An excellent option is to download your report to Excel.3. 2010 1:16 pm 5. To generate output in Excel: 1. 130 Getting Started with DB2 Web Query for i . These can be created in two formats.7214ch04.

then simply choose Excel 97 or Excel 2000 for your output. Chapter 5. Figure 5-47 Report Assistant Excel output Tip: If Gross Profit is calculated as a compute field instead of a define field.Draft Document for Review January 3.704. Having formulas instead of values in your report allows the total fields to adjust automatically.821. it is also represented in the Excel spreadsheet as a formula. This is a helpful feature for users who want to download reports and then analyze the data and possibly delete or move rows of data. you see that this is represented as a formula as opposed to an actual value of $162. If you look at the Excel input line. If you want to see the constant values downloaded. Notice the total for Audio in cell F9.fm Figure 5-47 shows the output of this report in Excel. Report Assistant 131 . 2010 1:16 pm 7214ch04.

Figure 5-48 Report Assistant output to a DB2 database file This time when you run your report. 2.3. Click the Report options tab. It also shows a section in the bottom right corner of the window where you can specify the library and file or table name you want to create. 1. the records are inserted in the table that you specify. 132 Getting Started with DB2 Web Query for i .DB2 database table in the first pane. This enters in DB2 . After the file insert is complete. select Show database formats in the second drop-down list (Figure 5-48 on page 132). you see a new window that tells you the number of records that were inserted into the DB2 table (Figure 5-49). 2010 1:16 pm 5.7214ch04.4 DB2 database file output One final output option that we investigate is the creation of a DB2 database file on the System i machine: Tip: You must have imported the metadata or created a synonym for your output table before you can use it as input to another query. On the Report options tab.fm Draft Document for Review January 3. Note: See “Using output files for the next query” on page 429 for recommendations about converting Query/400 definitions that currently create temporary output files in QTEMP.

Set your output option back to HTML as shown in Figure 5-43 on page 128 or reload your saved report. If you are still in your RA4_Advanced report. click the Selection criteria tab (Figure 5-50). open the RA4_Advanced report. we explore other types of reports. To do this. drag the PRODUCTTYPE field onto the empty white pane on the right.1 Parameterized reports We are asked to print our RA4_Advanced ranking report for a single product type that is requested at runtime. From the Available fields pane. If you are not.fm Figure 5-49 Report Assistant DB2 output confirmation 3. We continue with the last steps of our example. 3. we add an input parameter: 1. right-click the RA4_Advanced report and select Open. 2.4. 2010 1:16 pm 7214ch04. On the DB2 Web Query home page. Click Select values to define the parameter. 5. including: Reports that accept an input parameter. which are called parameterized reports Reports with drill-down capabilities 5. Figure 5-50 Report Assistant Selection criteria Chapter 5.4 Additional report types In this section.Draft Document for Review January 3. Report Assistant 133 .

We use the default name for this parameter of PRODUCTTYPE. they will be able to use the Windows standard Ctrl and Shift keys to select multiple product types. For the Description field in the Name section. Note: Choosing Dynamic presents the users with a distinct list of current values of the column when the query is run. leave it to default to a single input value. 134 Getting Started with DB2 Web Query for i .7214ch04. For now. select Parameter and then click the Auto Prompt icon ( ). Under Selection. ensure that Dynamic is selected (Figure 5-52). If you allow the users to select multiple values at runtime. Figure 5-51 Report Assistant parameter definition 5. The Static option allows you to define a predefined set of values. 2010 1:16 pm 4. enter the prompt that you want the users to see. In the EQ Values window (Figure 5-51).fm Draft Document for Review January 3.

Report Assistant 135 .Draft Document for Review January 3.fm Figure 5-52 Report Assistant Parameter properties Chapter 5. 2010 1:16 pm 7214ch04.

To make the drill-down report more understandable.fm Draft Document for Review January 3. c. Click the Report headings tab (Figure 5-53).Field list arrow and drag PRODUCTTYPE to the end of the heading.7214ch04. Figure 5-53 Report Assistant variable report heading 136 Getting Started with DB2 Web Query for i . Select the Show . 2010 1:16 pm 6. Add the words “for Type” to the heading. b. place the product type in the report heading: a.

Figure 5-54 Default page numbering 8. select Off (Figure 5-54). Figure 5-55 shows the results of running this report. Chapter 5. Since we know that this parameterized report is small and.fm 7.Draft Document for Review January 3. Report Assistant 137 . in most cases. Click the Report options tab and for Page numbering. remove the default page numbering. it fits on one browser page. 2010 1:16 pm 7214ch04. Run the report.

We now have a report that can either accept a parameter passed by another report or prompt the user for their input. In the Sort by pane. On the DB2 Web Query home page. right-click the RA1_Revenue report and select Open. highlight PRODUCTTYPE. 138 Getting Started with DB2 Web Query for i . On the Display tab. 1. 2010 1:16 pm Figure 5-55 Report Assistant Output parameter report 9. Save and close this report. we take our initial RA1_Revenue report and enable it to pass an individual product type to the report that we just created.2 Drill-down reports: Parent report (RA5_Child) In this section.4. click the Drill down button (Figure 5-56). Click the Show .7214ch04.fm Draft Document for Review January 3.Field options arrow. 3. 4. 2. 5.

Click the Execute procedure radio button. complete these steps: a. Navigate through the list until you find your RA4_Advanced report and select it.fm Figure 5-56 Report Assistant Drill-down option 5. 2010 1:16 pm 7214ch04. Figure 5-57 Report Assistant Drill-down window Chapter 5.Draft Document for Review January 3. Report Assistant 139 . add a comment for users to see when they hover over the Product Type field. In the Alternate comment for hyperlink field. b. c. d. Click Add. DB2 Web Query populates the list with your reports. In the next window (Figure 5-57).

In the Parameter name field. Run your report. select the Field option and then select the field that you want passed into the variable PRODUCTTYPE. In this case. iii. 7.fm Draft Document for Review January 3. Save your report: a. complete these steps: i. Click Audio to drill down to see more information. 2010 1:16 pm e. type the same name as the parameter that the drilldown report is expecting. b. ii. the product types are highlighted in blue indicating that they can be selected and you can then drill-down to a more detail report. Close the report and close Report Assistant. Click OK. Select the PRODUCTTYPE field. 140 Getting Started with DB2 Web Query for i . In the Save Standard Report window. In the Drill-down parameter window (Figure 5-58). Figure 5-59 shows the results of running the report. type PRODUCTTYPE. Under Parameter value. Figure 5-58 Report Assistant drill-down parameter window 6. Click the Save button at the top of the window and select Save As. enter the name it RA5_Child and click OK. Figure 5-59 Report Assistant parent (summary) and child (drill-down) reports 8. 9.7214ch04. In the parent or top-level report.

3 Report properties To view the properties of a report. right-click. output format. The Detail tab show all the tables and columns that are used in your query. You also see your sorting details. filtering criteria. The General tab of the Properties window shows the creation date. the domain.fm 5. on the DB2 Web Query home page.Draft Document for Review January 3. navigate to the RA4_Advanced report.4. 2010 1:16 pm 7214ch04. and select Properties. The results are shown in Figure 5-60. Figure 5-60 Report Assistant report properties You have now completed this tutorial. Chapter 5. and any joins that you might have explicitly defined. Report Assistant 141 . and most importantly the Href or file name on disk.

See Figure 5-61. you click the Join options tab to specify any additional tables that you want to access.7214ch04. In the window that opens. you must create your joins manually.fm Draft Document for Review January 3. If either of the tables do not have foreign keys defined or you choose not to include the foreign keys when you created the metadata. we explain the process that you must follow.5 Joining tables (reference only) You might have noticed that we never needed to join any tables together even though we looked at data from multiple tables. Figure 5-61 Report Assistant join options 142 Getting Started with DB2 Web Query for i . 2010 1:16 pm 5. After you select your main table to query. As previously discussed. this is because the tables were defined to DB2 with foreign key constraints. In this section. you highlight the table in the list to which you want to join and click OK. You must click New to create a new join.

you select the appropriate options (Inner Join. If you forget to do this and navigate away from this page. Single Instance: A one-to-one join structure that matches one value in the host data source to one value in the cross-referenced data source. If there are no matching values in the secondary table. It is recommended that. including all records from the left table (primary) and any records from the right table (secondary) where the condition values match. Joining employee ID in a company's employee data source to employee ID in a data source that lists all the training classes offered by that company would result in a listing of all courses taken by each employee. instead of this choice. Inner Join: An inner join combines rows from both tables where there is an exact match between the join fields. or a joining of the one instance of each ID in the host file to the multiple instances of that ID in the cross-referenced file. See Figure 5-62. Left Outer Join: This option retrieves records from both primary and secondary tables.fm Next you must define the actual join criteria. your join is not created. 2010 1:16 pm 7214ch04. Left Outer Join. Multiple Instance: A one-to-many join structure that matches one value in the host data source to multiple values in the cross-referenced field. You tell DB2 Web Query which field from each table that you want to use for your join. You must remember to click the Save & Create button.Draft Document for Review January 3. Joining an employee ID in an employee data source to an employee ID in a revenue data source is an example of a unique join. Report Assistant 143 . Figure 5-62 Report Assistant join definition Chapter 5. the join still retrieves the records from the host table. Single Instances). Join types: Unspecified: This option was created for compatibility with prior versions. Multiple Instances.

5. Use Report Assistant to create a new report in your Tutorials folder 2. If you select the Tree icon (between the calculator and the spreadsheet). 2010 1:16 pm After you save and create the first join definition. This is a quick visual check to help identify the different source tables. you see that the fields from both tables are available for use (Figure 5-63). The stored procedure added a row to an audit table and returned a result set from the HR table.6 Creating a report over a stored procedure synonym In “Stored procedure synonyms” on page 51. you can click New and proceed to define a second join if you want. When you click the Field selection tab. Figure 5-63 Report Assistant secondary table field Notice that the columns from the secondary table are in a different color than the columns from the primary table. you can see the fields listed in physical sequence by table. 144 Getting Started with DB2 Web Query for i . you learned how to create a synonym over a stored procedure. In this section you create a report over this synonym by taking the following steps: 1. From the list of displayed. select the stored procedure synonym CEN_HR_TABLE_AUDIT as shown in Figure 5-64.fm Draft Document for Review January 3. Tip: If you switch to tree mode and hover over a field name.7214ch04. additional information pertaining to that field is displayed.

fm Figure 5-64 Select stored procedure synonym The Report Assistant tool is displayed. This means they can be used as output fields in the report.Draft Document for Review January 3. Click <Select Value> as shown in Figure 5-66. Figure 5-65 Different segments from stored procedure synonym 3. The columns in the ANSWERSET1 segment are the columns returned in the stored procedure’s result set. Any columns in the INPUT segment can only be used as input parameters to the stored procedure. 2010 1:16 pm 7214ch04. Report Assistant 145 . Notice that the columns under the list of available fields have two different segment names: ANSWERSET1 and INPUT (Figure 5-65). Create a new input parameter to the report by dragging the INPLANTCODE column from the list of available fields to the Screening conditions area. Chapter 5.

To populate the list of plant codes to be displayed in the prompt control. Because these values are stored in the ORDERS cluster. Figure 5-67 Set up prompt control 5. Find and select PLANTCODE from this list and click OK. An example is provided in Figure 5-68. select CEN_ORDERS from the list of values for Data Source.fm Draft Document for Review January 3. This will repopulate the list of fields displayed. Select Parameter and make it a prompt control (drop down list) by clicking the Auto Prompt icon as shown in Figure 5-67 on page 146. 146 Getting Started with DB2 Web Query for i .7214ch04. 2010 1:16 pm Figure 5-66 Create input parameter for report 4. you can select a different data source.

Draft Document for Review January 3, 2010 1:16 pm

7214ch04.fm

Figure 5-68 Specify data source and field to populate prompt control Figure 5-69 on page 147

6. Click OK again. Your Selection Criteria should look like the example in Figure 5-69 on page 147

Figure 5-69 Input parameter to pass to stored procedure

Chapter 5. Report Assistant

147

7214ch04.fm

Draft Document for Review January 3, 2010 1:16 pm

When run, this report will prompt the user for an input parameter. The selected value will be passed as an input parameter to the stored procedure. 7. Next finish your report by doing the following (as displayed in Figure 5-70 on page 148): a. Sort by columns LASTNAME, FIRSTNAME, STATUS, and PAYSCALE b. Sum SALARY column and specify formatting of comma inclusion and floating currency.

Figure 5-70 Finish stored procedure report

8. Save your report as HR Salary Report 9. Run the report. Select a value from the Plantcode prompt control and click Run as shown in Figure 5-71 on page 149.

148

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:16 pm

7214ch04.fm

Figure 5-71 Run stored procedure report

10.As a final step, verify that running the report above resulted in a row being added to the audit log. From any SQL interface, run the following SQL statement: SELECT * FROM rptaudlog ; You should see a row that was logged as a result of running the HR Salary Report through DB2 Web Query: 2009-09-01 09:54:11.896625 HR Salary Report COBBG

5.7 Report Assistant summary
You have now completed the first tutorial and created a few different reports. In many of the remaining chapters, you modify the reports that you created in this chapter. We do not repeat information that is similar between the different components, in some cases, such as joining tables. In other examples, we list the steps but in far less detail. If you forget how to accomplish a function, return to this chapter for a refresher of the steps.

Chapter 5. Report Assistant

149

7214ch04.fm

Draft Document for Review January 3, 2010 1:16 pm

150

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:16 pm

7214ch05.fm

6

Chapter 6.

Graph Assistant
Graph Assistant provides a wide variety of graph types and graphing functionality to allow users to choose how to present their data in the best possible format. The available graph types range from a variety of bar and line charts to histograms and area charts, stock charts, gauges for key performance indicators, and much more. You can find additional details about the graphing facility in the help text. In this chapter, we continue with the same Century database used in the previous tutorials. In this chapter, we complete the following tasks: Create a simple bar chart that shows revenue by product type within country. We drill down from this graph to the detail report that we created previously with Report Assistant. We then modify this graph to be a dual axis bar and line chart that accepts country as an input parameter. Create a line chart that shows revenue trending over time. The users can specify the time range they want to see. Create multiple pie charts with traffic lighting or conditional styling based on a calculated field.

© Copyright IBM Corp. 2009. All rights reserved.

151

7214ch05.fm

Draft Document for Review January 3, 2010 1:16 pm

6.1 Tutorial overview: Bar chart
In this exercise, we initially create a bar chart that allows the user to drill down to a previous report (Figure 6-1).

Figure 6-1 Completed bar chart with drill down

152

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:16 pm

7214ch05.fm

We then modify this bar chart to create a dual axis bar and line chart that accepts country as an input parameter. See Figure 6-2.

Figure 6-2 Modified chart by adding a gross profit line

Chapter 6. Graph Assistant

153

7214ch05.fm

Draft Document for Review January 3, 2010 1:16 pm

6.2 Creating a simple bar chart with drill-down capabilities
(GA1_Bar)
To create a simple bar chart with drill-down capabilities: 1. Right-click the Tutorials folder and select Graph Assistant. 2. In the window (Figure 6-3) that opens, select the same CEN_ORDERS table that we used in the previous tutorials. Click OK.

Figure 6-3 Starting Graph Assistant

154

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:16 pm

7214ch05.fm

3. In the Graph Assistant, click the Graph types tab (Figure 6-4). On this tab, complete the following steps: a. Under Select from the following graph types, look at the various chart types that are available. For graph type, choose a Bar chart type. b. For each chart type, there are many variations shown in the Graph Styles pane. For Graph Styles, select Clustered. c. Look at the various templates under Apply template. Select Cylinder on grey.

Figure 6-4 Graph Assistant Graph type selection

Chapter 6. Graph Assistant

155

7214ch05.fm

Draft Document for Review January 3, 2010 1:16 pm

4. Click the Field selection tab (Figure 6-5). 5. Define the fields that represent the x and y axis for the chart: a. Drag LINETOTAL to the Sum pane. This is our Y axis. b. Drag COUNTRY to the X axis field. c. Drag PRODUCTTYPE into the separate graph area field. By default, this produces one chart for each separate plant.

Figure 6-5 Graph Assistant Field selection

6.2.1 Adding multiple bars to one chart
To add multiple bars to one chart: 6. On the Field selection tab, under the Graph fields section, ensure that PRODUCTTYPE is still highlighted. 7. Click the Show - Field options for PRODUCTTYPE. 8. Select Merge graphs into a single graph. Instead of having a graph for each product type, this option merges the graphs so that each type is a separate bar within each country.

156

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:16 pm

7214ch05.fm

9. Click the Headings tab (Figure 6-6). Graphs can have headings both at the page level and at the individual chart level. Click the Graph tab. Under Chart title, type “Revenue by Product Type” and for Chart subtitle, type “Country Comparison”.

Figure 6-6 Graph Assistant Chart titles

10.Save your graph as GA1_Bar and then run it. Figure 6-7 shows the results of running this report.

Figure 6-7 Graph Assistant Revenue by Product Type Chart

Chapter 6. Graph Assistant

157

7214ch05.fm

Draft Document for Review January 3, 2010 1:16 pm

6.2.2 Adding a drill down to a chart
Now that we have our chart, we want the users to have the ability to double-click any of the bars and drill down to the detailed product type report that we created earlier: 11.Return to the Field selection tab, and highlight LINETOTAL. 12.Under Field options - LINETOTAL, on the Display tab (Figure 6-8), click the Drill down button.

Figure 6-8 Graph Assistant Drill-down button

13.In the next window that opens (Figure 6-9), complete these steps: a. Select Execute procedure and a list of your reports is populated in the top white pane. b. Navigate to and select the RA4_Advanced report that you created earlier. After you select your procedure, the Add button becomes available. c. Click Add to add the parameter that you pass from this report to the RA4_Advanced report.

Figure 6-9 Drill-down selections

158

Getting Started with DB2 Web Query for i

it accepts the value and executes the report. Since this is the name of the parameter that the Advanced report was expecting. We do this by passing the value as a parameter called PRODUCTTYPE. select Field and then select the field that you want to pass as the parameter value. b.Draft Document for Review January 3. Under Parameter name. In this graph. this is the PRODUCTTYPE parameter that is linked in the gross profit report to the PRODUCTTYPE field. we tell the system that we want the RA4_Advanced report to run. We defaulted our parameter name to equal the input column name of PRODUCTTYPE. 2010 1:16 pm 7214ch05. Graph Assistant 159 . c.fm 14. you indicate where users can drill down. For Parameter value. This name must match the name that the child report is expecting to be passed. In the parent report or graph. Chapter 6. Figure 6-10 Graph Assistant parameter passing Drill down: When you drill down from one report to another.In the next window (Figure 6-10). When they click a bar. type PRODUCTTYPE. complete these steps: a. In our case. the users can drill down on any LINECODE or bar. which is PRODUCTTYPE. Click OK. the child report expects a parameter. We also indicate that we are going to pass in the PRODUCTTYPE field that is referenced by the selected bar.

1. Figure 6-11 Graph Assistant drill down from chart to report Note: In this drill-down example. The hand indicates that you can drill down in this area. and click Open. 6. This way we can see the relationship between our revenue and the profit that each product generated. Gross profit has its own Y axis. First you see the product type. and lastly the revenue or line total. 160 Getting Started with DB2 Web Query for i .3 Creating a dual axis bar and line chart (GA2_Parm) In this exercise. a window opens that shows all the details about the bar. If we do this. we pass the product type to the child report. If you closed the bar chart that you just created. 2010 1:16 pm 15. locate GA1_Bar. We also add gross profit as a line chart on top of our existing bar chart. then the country. 2. 16. they can pass the country name as well as the product type as filters or parameters to the Gross Profit report (RA3_GrossPft).fm Draft Document for Review January 3.7214ch05. Figure 6-11 shows the results of running this report. We could design the report to accept both country and product type.Roll over the bars with your mouse. Notice that the cursor changes from an arrow to a hand. navigate to the Tutorials folder. we change COUNTRY from a set of bars to an input parameter. Click the Field selection tab. right-click the report name. when the user clicks the same bar.Save and then run this graph. When you hover over a bar.

to be PRODUCTTYPE. b. Change COUNTRY in the Field value plotted on X axis field. If you closed your graph preview box. you can click the Run button to see how your chart looks up to this point. Click the Selection criteria tab (Figure 6-13). 2010 1:16 pm 7214ch05. Add COUNTRY as a parameter: a. You can choose one of the following options: • • Delete COUNTRY by clicking the Sort Across Remove (X) button. click the Graph Type tab and select Show Graph Preview. d. Drag PRODUCTTYPE on top of COUNTRY. c. Graph Assistant 161 . Click Select values. b. 4.Draft Document for Review January 3. which does an automatic replace. Drag COUNTRY from the Available field list to the pane on the right. Modify the existing graph slightly as shown in Figure 6-12: a. remove PRODUCTTYPE by highlighting the entry and clicking the red Sort Across Remove (X) button. Using the Update button on the graph preview is useful during development. In this case. Figure 6-13 Creating a parameter for COUNTRY Chapter 6. the defaults of WHERE and EQUAL TO are appropriate since we want the user to select or specify a single country. In the Create a separate graph for each value of this field.fm 3. Figure 6-12 Changing X axis columns Note: At any time during development.

Save your report as GA2_Parm. 2010 1:16 pm e. complete these steps: i. Figure 6-14 Parameter Auto Prompt f. We just created a simple bar chart that prompts the user for country. iii. 162 Getting Started with DB2 Web Query for i . ii. type “Select Country:”.fm Draft Document for Review January 3. select the default options. In the Parameter Properties window (Figure 6-15). In the next window (Figure 6-14). For the remainder of the window. Remember that you can run your report or update the graph preview at any time. Click OK. For Description.7214ch05. Figure 6-15 Details about COUNTRY parameter 5. select Parameter and click the Auto Prompt icon. which you can try and see how it works. Change the prompt that the user sees.

Graph Assistant 163 . click the calculator icon and select New define field (Figure 6-17).Draft Document for Review January 3. Figure 6-16 Selecting a Dual-Axis Clustered graph type 7. create it: a. ii.1 Adding a second Y axis Redefine the graph as one that supports a second Y axis: 6.fm 6. Enter the following formula: LINETOTAL . Click the Field selection tab. In the window that opens (Figure 6-18). On the Field selection tab.COSTOFGOODSSOLD Now Gross_Profit is available for us to use. b. you can type the formula manually or open the field list pane to the right and double-click the field names to move them over. type Gross_Profit. Figure 6-18 Calculating gross profit Chapter 6. Click the Graph types tab (Figure 6-16). Change the Graph Styles from Clustered to Dual-Axis Clustered. 2010 1:16 pm 7214ch05. For Field. complete these steps: i. Superimpose Gross Profit as a line on top of the existing bar chart. Figure 6-17 Selecting New define field c.3. Since Gross Profit does not exist in the field list. To define the field.

10.Ensure that there is a heading for the graph: a. For Force the values on this field to be plotted as. Drag Gross_Profit to the Y axis panel below LINETOTAL. Click Show . b. c. For Place this field on the specified axis. Figure 6-19 Adding a second Y axis for a line chart 11. Figure 6-20 Graph headings 12.Field options . We do not need a subtitle for this graph. and complete these steps: a. 9. See Figure 6-20. 164 Getting Started with DB2 Web Query for i . Click the Headings tab.Gross_Profit. select Line. Click the Graph subtab. Under Chart title.Click the Visualize subtab (Figure 6-19).7214ch05.fm Draft Document for Review January 3.Save and run your graph. b. 2010 1:16 pm 8. the graph title is “Revenue by Product Type”. select 2nd axis.

select Germany.In the report that is displayed. for Select Country. Graph Assistant 165 .Draft Document for Review January 3. Figure 6-21 Dual axis bar and line chart with prompting Chapter 6. 2010 1:16 pm 7214ch05.fm 13. Then you see the results shown in Figure 6-21.

Save and run your report. select the Y axis subtab (Figure 6-22). From the drop-down list. b. a. select $10M to show the Y (gross profit) axis as millions of dollars. Let us simplify this for our users: 14. select Y1 axis to format the product type y axis values. 2010 1:16 pm Modifying graph properties and settings Overall the graph looks like what we wanted. 15.On the Properties tab.fm Draft Document for Review January 3.7214ch05. 166 Getting Started with DB2 Web Query for i . The one potential concern is ensuring that the users can quickly and easily read the values on the Y axis. Figure 6-23 shows the result of the chart. Both the revenue and profit are large numbers in the millions. For Value format.Click the Properties tab. Figure 6-22 Formatting Y axis values 16.

Chapter 6. Then we modify this chart to allow the user to specify the time range in which they are interested (see Figure 6-24). our users are now less likely to misinterpret the dollar values. With these minor changes.fm Figure 6-23 Dual axis bar / line chart with prompting 17. 6.Close Graph Assistant.4 Creating a revenue trend over time chart (GA3_Line) In this exercise. Graph Assistant 167 . first we create a simple line chart that spans two years (includes all our data). 2010 1:16 pm 7214ch05.Draft Document for Review January 3.

fm Draft Document for Review January 3. 2010 1:16 pm Figure 6-24 Trending report with a variable date range 168 Getting Started with DB2 Web Query for i .7214ch05.

select the table Cen_Orders and click OK. Right-click your Tutorials folder and select Graph Assistant (see Figure 6-25).fm 6. Figure 6-25 Creating a new graph Chapter 6. In the window that opens (inset in Figure 6-25). 2.5 Creating a line graph To create a line graph: 1. Graph Assistant 169 .Draft Document for Review January 3. 2010 1:16 pm 7214ch05.

Click the Field selection tab. convert the date field from year. under Select from the following graph types. Click the calculator icon and select New define field (Figure 6-27). In the next window. b. To do this. select Line. select Absolute. To show product revenue trending by month. 2010 1:16 pm 3. 4. Figure 6-27 Defining a new field 170 Getting Started with DB2 Web Query for i .7214ch05. and day to a field with just the year and month. On the Graph types tab (Figure 6-26). Then under Select from the following Graph Styles. click the Graph types tab. a.fm Draft Document for Review January 3. month. Figure 6-26 Selecting a graph type for a line chart 5. you must plot one point for every month for each product.

Draft Document for Review January 3. DB2 Web Query is powerful when it comes to working with date and time fields. Graph Assistant 171 . iv. In the Define field creator window (Figure 6-28). ii. In the pane below Field. See “Date and time system variables” on page 514 for many of the different ways you can work with date and time fields. iii. we specify a format of YYTM. type TMYY. where you define the formula for the new field. T means that the month or day immediately following will be represented as uppercase text. For Field. If we want to place the year first. 2010 1:16 pm 7214ch05. 2007. A single Y means that you want to display a two-digit year. Click OK. type ORDERDATE. Figure 6-28 Creating a date field of month and year Chapter 6. complete these steps: i. An example of a MthYr value is Jan. which is the name of the date on which MthYr is based. In the Format field. but YY means that you want to display a four-digit year. type MthYr.fm c.

ii. On the Field selection tab (Figure 6-29). Figure 6-29 Creating a line graph with multiple lines 172 Getting Started with DB2 Web Query for i . specify PRODUCTTYPE.7214ch05.PRODUCTTYPE. Drag LINETOTAL to the Sum/Print pane under Field value(s) plotted on Y axis. Select the Merge graphs into a single graph option. 2010 1:16 pm d. complete these steps: i. Under Create a separate graph for each value of this field. Drag MthYr to the Field value plotted on X axis (our main X axis) pane.fm Draft Document for Review January 3.Field options . Tip: You must place LINETOTAL in the SUM/Print pane before you can drag PRODUCTTYPE to the Create a separate graph for each value of this field pane. Click Show .

Field options .fm 6.Draft Document for Review January 3. Graph Assistant 173 .MthYr and under X axis field label. Figure 6-30 Removing the X axis field label 7. remove the heading or label for MthYr from the graph (see Figure 6-30): a. Under Field value plotted on X axis. delete the label MthYr. Chapter 6. Click Show . Since an entry on an axis of “Jan. Save your report as GA3_Trend. highlight MthYr. b. 2007” is obviously a date. 2010 1:16 pm 7214ch05.

174 Getting Started with DB2 Web Query for i . Figure 6-31 shows the results of running this report. Run your report.7214ch05. Figure 6-31 Two-year product revenue trend lines 9. Click the Style labels button. Click the Properties tab and then click the X axis subtab. 2010 1:16 pm 8. b.fm Draft Document for Review January 3. Change the X axis to rotate the text and make it look better: a.

iii. In the X Axis Properties window (Figure 6-32). Graph Assistant 175 . For Text rotation. Click OK. certain style options are disabled. Check here to override defaults check box.fm c. Under Set Style for. Figure 6-32 45-degree x axis labels Chapter 6. iv. select Data. ii. 2010 1:16 pm 7214ch05. Select the Because automatic arrangement is turned on. complete these steps: i.Draft Document for Review January 3. Some of the options initially are unavailable because a default style sheet is in effect. select 45-degree bottom to top.

Figure 6-33 Report with 45-degree X axis labels 6. 2006 and ending with orders received on June 30. We display one year’s worth of data starting with orders that were generated on July 1.5. Next we select a specific range to display.7214ch05. we plotted one point for every month. 176 Getting Started with DB2 Web Query for i .Save and run your report. This is not practical because the history grows in size. 2010 1:16 pm 10. After we look at the options for hardcoding a range.fm Draft Document for Review January 3. we look at how the user can specify an ad hoc range. year combination in our data. 2007.1 Adding a date range filter to a line graph Up to this point. Figure 6-33 shows the result of running this report.

2010 1:16 pm 7214ch05. select Constant and type 072006. In the GE Values window. for MthYr. As stated previously.In the Screening conditions pane. Graph Assistant 177 . select GREATER THAN or EQUAL to and then click Select values to enter the date. complete these steps: a. Figure 6-34 Selection criteria for date Chapter 6. our range is all orders inclusively from July 2006 to June 2007.Drag MthYr to the Screening conditions pane on the left.fm To filter the dates: 11. b.Click the Selection criteria tab (Figure 6-34). To select the records as we read them.Draft Document for Review January 3. 12. c. use the WHERE default as opposed to WHERETOTAL. For our first WHERE clause. 13.

select Constant and type 062007.7214ch05. You have now defined a range where 072006 <= MthYr <= 062007. Figure 6-35 Selecting date ranges 17. complete these steps: a.Drag MthYr to the Screening conditions pane (see Figure 6-35). 2010 1:16 pm 14.In the Screening conditions pane. Figure 6-36 shows the results of running this report. 16. the two conditions that you define will be ANDed together.Save and run your report. Notice that our report now starts with July and ends with June. 15.fm Draft Document for Review January 3. In the LE Values window.Notice that. by default. b. Select LESS THAN or EQUAL to and click Select values. Figure 6-36 Specific date range 178 Getting Started with DB2 Web Query for i .

Figure 6-37 Removing screening conditions ii. Run your report. It should look exactly the same as our previous report. Using the same steps as we did with MthYr. 2010 1:16 pm 7214ch05. Chapter 6.fm Here are a couple of options that achieve the same results: – Option 1 i. In the Screening conditions pane (Figure 6-37).Draft Document for Review January 3. Figure 6-38 Using ORDERDATE column iii. select both conditions. Remove the selection criteria that we specified. this time drag ORDERDATE to the Screening conditions pane and specify the full date. Graph Assistant 179 . See Figure 6-38. Then click the red X under the text “Screening conditions” to remove them.

ii. Select FROM . for the From criteria. Figure 6-39 Date From-To option v.fm Draft Document for Review January 3. type 20060701. type 20070630.TO and click Select values. Run your report. 180 Getting Started with DB2 Web Query for i . iii.7214ch05. and for the To criteria. Drag ORDERDATE to the Screening conditions pane. iv. Remove the previous screening conditions. 2010 1:16 pm – Option 2 i. Again the same report is generated. In the FROM-TO values window (Figure 6-39).

fm 6.Remove your existing Screening conditions. Click Select values. 22. In the GE Values window (Figure 6-40). b. 19. select Parameter. select Parameter and name the parameter TO_DATE. complete these steps: a. Click OK.Drag ORDERDATE to the Screening conditions panel. we allow the user to specify their date range instead of forcing one on them: 18. Select GREATER THAN or EQUAL to and click Select values. b. Enter a parameter name for your user such as FROM_DATE.2 Adding a user-specified date range parameter In this next example. Select LESS THAN or EQUAL to. 2010 1:16 pm 7214ch05. Chapter 6. Figure 6-40 Creating a date parameter 21.5. complete these steps: a.Draft Document for Review January 3.In the Screening conditions pane (Figure 6-40).Again drag ORDERDATE to the Screening conditions pane. In the LE Values window. 20.In the Screening conditions pane (Figure 6-41). Graph Assistant 181 . instead of specifying a constant.

fm Draft Document for Review January 3.Save and run your report. 182 Getting Started with DB2 Web Query for i . Figure 6-42 Trend graph with variable date range 24.7214ch05. 2010 1:16 pm Figure 6-41 Defining parameters for a date range 23. Figure 6-42 shows the results of running this report.Try various date combinations.

Draft Document for Review January 3. we saw multiple ways to hard code a date range and how to have the user specify a variable date range. Chapter 6. 2010 1:16 pm 7214ch05. Graph Assistant 183 .fm In this exercise.

2. We then add conditional styling or traffic lighting to our pie charts based on comparisons with calculated values. right-click and select Graph Assistant. See Figure 6-43.6 Working with pie charts (GA4_Pie) In this exercise. 184 Getting Started with DB2 Web Query for i . one for each year. In the window that opens.fm Draft Document for Review January 3.7214ch05. 2006 Audio (25%) Video (33%) Video (34%) 2007 Audio (24%) Office (2%) Cameras (12%) Camcorders (28%) Revenue Office (2%) Cameras (12%) Camcorders (29%) Revenue Red pie slices indicate an average markup of less than 35% Red pie slices indicate an average markup of less than 35% Figure 6-43 Yearly pie charts with conditional styling or traffic lighting 6. Navigate to your Tutorials folder. we create a single chart that contains multiple pie charts.7 Creating a product type pie chart for each year To create a product type pie chart for each year: 1. 2010 1:16 pm 6. choose the Cen_Orders table and click OK.

fm 3. select Basic. 2010 1:16 pm 7214ch05. On the Graph types tab (Figure 6-44). under Select from the following graph types. For Select from the following Graph Styles. select Pie. 4. We do not currently have a field that contains just the year. Graph Assistant 185 . Chapter 6.Draft Document for Review January 3. Click the calculator icon and select New define field. Click the Field selection tab. Figure 6-44 Selecting a graph type In this example. 5. we create a pie chart for each year in our data.

1. 8. Figure 6-45 Creating a year field Tip: If you are tired of splitting ORDERDATE into its various components for each report. this creates a separate graph for each value in Year. make sure that you continue to progress to the tutorial in 12. In the Define field creator window (Figure 6-45). Click OK. This means that we will have a pie slice for each product type. Remember that this creates a four-digit year. By default. 9. In the pane under Field. Drag PRODUCTTYPE to the Field value plotted on X axis pane. Drag LINETOTAL to the Field value(s) plotted on Y axis box. “Date Decomposition” on page 348. 186 Getting Started with DB2 Web Query for i . This means that the product type pie slices will be proportionately sized based on the LINETOTAL summed values.fm Draft Document for Review January 3.Drag Year to the Create a separate graph for each value of this field pane.7214ch05. specify that the field is to be based on ORDERDATE. 2010 1:16 pm 6. for example 2007. Click the Field selection tab to define the fields used in the pie chart. See Figure 6-46 on page 187. 7. type Year and for Format. type YY. for Field. This tutorial shows how to automatically break down a date and make the components available to all reports.1. 10.

Type a value of 2 next to the Display graph in number of columns option to indicate that you want two graphs across the page. Graph Assistant 187 .fm 11. a. Figure 6-46 Pie chart field definitions 12. If you had six different years. small pie charts across the page in a single row.Click Show . b.Field options .Run or preview your chart.Year. these settings would create six pie charts in a 2 x 3 layout. The graph is essentially complete. Chapter 6.Draft Document for Review January 3. 2010 1:16 pm 7214ch05. If you specified six across. you would have six. Select the Display graph in number of columns option.

As you can see in the Graph preview. To remove the legend from your pie chart. In the Graph preview window. In the end. you still see the legend. Try selecting the different option combinations from both columns to see the results.fm Draft Document for Review January 3. clear the Automatic update option. click the Properties tab and the Settings subtab. select Show pie labels. which duplicates the information on the slice labels. 2010 1:16 pm 13. a. Instead we want the labels directly on or next to the pie slices for easy readability. c. 188 Getting Started with DB2 Web Query for i . Tip: If you closed or lost your Graph preview window. select the Labels only and Slice label and % value options. Figure 6-47 Automatic update for Graph preview 14. d. click the Graph types tab and select Show graph preview. Whether you permanently work in Automatic update mode is strictly a performance question. While viewing the Graph preview window. b. Click the Properties tab and the Pie subtab (Figure 6-47).Often a graph is easier to read without a legend.7214ch05. In the Graph preview window. select the Automatic update option.

For Horizontal. type 400 pixels.Draft Document for Review January 3. 2010 1:16 pm 7214ch05.On the Settings tab (Figure 6-48). On the Options tab. and for Vertical.Tell DB2 Web Query the size to make each of our pie charts: a.fm 15. Figure 6-49 Specifying custom graph sizes Chapter 6. Figure 6-48 Legend removal 16. Click the Properties tab and the Options subtab. b. type 300 pixels. clear the Show legend option. Graph Assistant 189 . select Custom size.

fm Draft Document for Review January 3. Note: DB2 Web Query calls a new field calculated at input time a define field. Specifically if the markup that the product is sold for is lower on average than corporate standards. notice how similar the graphs look compared to the Graph preview window in Figure 6-47 on page 188. 2006 2007 Audio (25%) Video (33%) Video (34%) Audio (24%) Office (2%) Cameras (12%) Camcorders (28%) Revenue Office (2%) Cameras (12%) Camcorders (29%) Revenue Figure 6-50 GA4_Pie chart As we expect. 6. See Figure C-1 on page 563 for more details.8 Conditional styling or traffic lighting a graph The last area that we want to address in our graphing tutorial involves having segments of the graph highlighted based on a condition in our data. 2010 1:16 pm 17. We must calculate the average markup after we aggregate our data. you can specify whether you want a new field calculated as records are read or after the input records are processed and aggregated. In this case. As previously discussed with DB2 Web Query. “Processing differences between the define and compute fields” on page 563. This processing sequence is described in more detail in Appendix C. Figure 6-50 shows the results of running this report.7214ch05. 190 Getting Started with DB2 Web Query for i . Summing an average calculated at record input time gives us inaccurate results. we want to highlight this. It is straight forward to say highlight LINETOTAL when LINETOTAL is greater or less than a predefined number. we want to highlight the pie segments based on the profit margin of that segment. A field that is calculated after all aggregation is done is called a compute field.Save your chart as GA4_Pie and run the report.

To create a compute field. 2010 1:16 pm 7214ch05. 2. If this report is not open.fm 1.Draft Document for Review January 3. Graph Assistant 191 . open the GA4_Pie report. click the Field Selection tab (Figure 6-51). right-click the GA4_Pie report and select Open. Figure 6-51 Initiating the compute field wizard Chapter 6. select the Wizard icon next to the Print button. On the DB2 Web Query home page. If you are still in your GA4_Pie report.

2010 1:16 pm 3.COSTOFGOODSSOLD) / COSTOFGOODSSOLD) * 100 You can either type the field names or select them by double-clicking the names on the left. 5. Figure 6-53 Making a field invisible 192 Getting Started with DB2 Web Query for i . Figure 6-52 Creating a compute field While MARKUP is a field that we need to reference in our conditional styling. for Field. we do not want to display a graph of MARKUP data. select the Make this field invisible option.7214ch05.fm Draft Document for Review January 3. highlight MARKUP. This makes MARKUP available to the report but does not display it on the graph. Click OK. On the Display tab. Click Show . In the Compute field creator window (Figure 6-52). Type the following text in the pane: ((LINETOTAL . type MARKUP. Under Field value(s) plotted on Y axis. The DB2 field names must be in uppercase.Field options (Figure 6-53). 4. Specify the formula in the pane below Field.

Graph Assistant 193 . Click the Add wizard icon (Figure 6-55).Draft Document for Review January 3.fm 6. b. iv. c. Highlight LINETOTAL under Field value(s) plotted on Y axis. v. Give this condition the name of Low_Markup.Field options. i. Figure 6-54 Conditional styling d. ii. Define the pie slices that you want to highlight (Figure 6-54): a. For Relations. Click OK. iii. For Please select a value. We want to highlight the pie segments or slices that have a lower markup than our company standard of 35% (Figure 6-56). 2010 1:16 pm 7214ch05. Figure 6-55 Conditional Styling Add wizard e. select MARKUP. select is less than or equal to. type the value of 35. For Field. Chapter 6. Click Show . Click the Conditional styling button.

Click the grey color indicator box (circled in Figure 6-58 on page 195). i.7214ch05. Figure 6-57 Attaching a condition definition ii. Highlight Low_Markup and click the Add Condition icon. See Figure 6-57. 194 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. Attach the condition definition to LINETOTAL and define what happens when this condition is satisfied. 2010 1:16 pm Figure 6-56 Creating a conditional styling condition f.

choose Red. You typically do this via a subheading or a page footing or footnote.fm iii. select the color that you want the pie slices when the slice meets the Low_Markup condition. When modifying a report by applying filters or using traffic lighting. we recommend that you indicate this information on the report itself. Graph Assistant 195 . Under Chart footnote. Chapter 6.Draft Document for Review January 3. Figure 6-58 Conditional styling highlighting 7. a. 2010 1:16 pm 7214ch05. In this example. type Red pie slices indicate an average markup of less than 35%. b. In the Color window (Figure 6-58). Select the Headings tab and click the Graph subtab (Figure 6-59).

2006 Audio (25%) Video (33%) Video (34%) 2007 Audio (24%) Office (2%) Cameras (12%) Camcorders (28%) Revenue Office (2%) Cameras (12%) Camcorders (29%) Revenue Red pie slices indicate an average markup of less than 35% Red pie slices indicate an average markup of less than 35% Figure 6-60 GA4_Pie low markup charts You have now finished the Graph Assistant tutorial. 2010 1:16 pm Figure 6-59 Explanatory chart footnote 8.7214ch05. 196 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. Figure 6-60 shows the results of running this report. Save your report and run it.

Power Painter Power Painter is a Web layout and report creation tool. This allows a thin browser to deliver advanced functionality without add-ons and plug-ins. and tailor the request for PDF output. The idea is for you to become familiar with the various ways of achieving similar end results. Power Painter supports a live feed to your data to allow for real What You See Is What You Get (WYSIWYG) report creation. All rights reserved. you can use multiple data sources to build your compound reports. © Copyright IBM Corp. In this tutorial. With AJAX technology. 2009.Draft Document for Review January 3. we build reports similar to those that we built using Report Assistant and Graph Assistant. With Power Painter.fm 7 Chapter 7. With HTML. We lay out the report and graph on one page. Power Painter allows you to create a compound report combining multiple graphs and charts on a single page. 2010 1:15 pm 7214ch06. you must update the entire panel. You can link the various charts together all tied to a common sort group. link them by COUNTRY. 197 . It is built using the new AJAX technology. the application can update portions of the panel for improved flexibility and performance.

The main Power Painter window is composed of standard drop-down menus at the top (File. You can move the palettes around the window or you can dock them on the right side. To know what the function is of each icon.7214ch06. select the Cen_Orders table and click OK. 3. and various palettes.1 Tutorial overview (PP1_PDF) In this tutorial. In the Open window (Figure 7-2). We do this before we create our report. right-click. 2. you can use View → Palette → various palettes. if it is closed. we explain how to launch Power Painter and tailor the main Power Painter window to look and work in a way that we are comfortable with. we build a PDF file that shows profit analysis by region with a separate graph and report for each country. 2010 1:15 pm 7. a row of icons immediately below the menus. Figure 7-1 Power Painter exercise PDF output 7. hover over an icon to see a description. and select Power Painter. See the example in Figure 7-1. Open DB2 Web Query. Navigate to your Tutorials folder. To open the palettes. Edit. You can open most of the palettes by using the icons below the menus. Let us get started: 1. and so on). an empty canvas on which to design your report. The PDF file has a table of contents that lets a user quickly jump to the country that they are interested in.fm Draft Document for Review January 3.2 Launching Power Painter and tailoring the main window In this section. 198 Getting Started with DB2 Web Query for i .

2010 1:15 pm 7214ch06. b. Changing the Reports & Graphs preview settings to sample data will improve development performance while using Power Painter.fm Figure 7-2 Selecting a data source in Power Painter 4. In the Preferences Window (Figure 7-3) Click on the Reports & Graphs tab and uncheck the Use Live Data option. Set Power Painter User Preferences a. Figure 7-3 Changing Power Painter User Preferences Chapter 7. You can set your Power Painter user preferences by choosing Edit -> Preferences. Power Painter 199 .Draft Document for Review January 3. You can also change the Record Limit to 100 to improve building the sample reports and graphs.

We bring it back to the main docking area later. you can move the Properties box back to the docking area and click the pushpin button for Data Sources so that it minimizes to the side. and above your Data Sources palette.fm Draft Document for Review January 3. the two main palettes that you use are the Query palette and the Data Sources palette. underneath the Toolbox. After you select your columns. You can have more than two palettes open and docked. c.7214ch06. This keeps the Query and Properties palettes in full view while you design the desired layout and design of your report. Drag the query palette to the right. 2010 1:15 pm You will want to change which palettes are open based on the work that you are doing. Either choose View → Palettes → Query or click the query icon (multi-colored circle with a question mark. Figure 7-4 The main window in Power Painter While you initially lay out your report. The example in Figure 7-4 is one design that appears to work quite well and will be used in this tutorial. with a graph below the logo and heading. In this report. b. we want our page to start with our logo or picture and a heading. circled in Figure 7-4). 200 Getting Started with DB2 Web Query for i . and the main report below the graph. a. Click the pushpin button of the open Properties palette. This temporarily makes it a tab on the right side. but they can become a little small to work with effectively.

Figure 7-5 Inserting a graph Chapter 7. While Graph Assistant allows you to drill down to another report or graph. This rectangle outlines the margins for your graph. We start by building a bar graph that shows the individual regions in a country and their revenue attainment: 1. You can move and size the graph by using the mouse after you initially place it. text properties. Maximize your window. colors. You can selectively control the color of the quality bands and the gauge needle.fm 7. this function is not available in Power Painter.2. Using gauges becomes much more meaningful with Power Painter. “Launching Power Painter and tailoring the main window” on page 198. Leave room for a report title at the top of the page. Click the graph (bar chart) icon in the Toolbox (Figure 7-5). 4. Power Painter 201 . If you closed Power Painter. you can add annotations to your graphs. and more. legend formatting.3 Building a graph with Power Painter The graphing component in Power Painter is a more full function and advanced graphing tool than Graph Assistant. 2. draw a rectangle on the canvas. It allows you more control over styling. With Power Painter. Using your mouse. open it as explained in 7. 2010 1:15 pm 7214ch06. 3.Draft Document for Review January 3.

you can view column names in multiple sequences. Click Finish. 2010 1:15 pm 5. including in alphabetical sequence. However. 202 Getting Started with DB2 Web Query for i . for example. In the New Chart window (Figure 7-6) that opens. If we want to display a series of bar charts. The icons in the Data Source bar allow you to change the displayed sequence. one bar for each year for each representative. Use the drop-down arrows on both the hierarchy structure icon and the list icon to see the different choices. then we select the CrossTab box.7214ch06. Similar to Report Assistant and Graph Assistant.fm Draft Document for Review January 3. select the default Vertical Clustered Bar chart. Figure 7-6 Power Painter selecting a graph type 6. we do not need to do this for this example. For this example. or in a tree type hierarchy based on table names. you see that Power Painter offers more advanced graph controls in most areas than Graph Assistant. Define the columns that are required in the graph. Remember that our Orders data source is composed of multiple tables that are all joined automatically by foreign key definitions.

Draft Document for Review January 3. When you drag a field onto the report area of the canvas. Drag LINETOTAL onto the Y Axis label. 2010 1:15 pm 7214ch06. Tip: Make sure that you select your graph before you drag the field. Power Painter 203 . See Figure 7-7. Figure 7-7 Field Selection for graphing Chapter 7. drag the field name either onto the graph that you just created or onto the Query palette. The open Query palette relates to the highlighted object. To include a field on the report.fm 7. a. a Query palette opens.

7214ch06. The report layout you define is repeated for each new value. Now any time you select a field in the query palette. Figure 7-8 X group axis field selection c. Double-click the Properties tab on the right side of the window to redock the Properties palette. 9. you might find it easier to bring the Properties palette to the front and minimize the Data Sources palette: a.fm Draft Document for Review January 3. 204 Getting Started with DB2 Web Query for i . Drag REGION onto the X group axis label (Figure 7-8). Drag COUNTRY onto the Coordinated label (Figure 7-9). 2010 1:15 pm b. Each change in the coordinated field causes a page break. Click the pushpin icon to minimize the Data Sources palette. you see that field’s properties in the Property palette. b. Tip: Coordinated fields are common sort fields and filters that tie together the various reports and graphs on your page. Figure 7-9 Adding a Coordinated field 8. Save your report as PP1_PDF. After choosing most of the fields.

Our graph is now complete. To see all the chart properties. you must open the Chart Editor. Look at the various properties available between the Chart Editor and the properties box.fm Tip: The Property box changes between Document properties. If you select a column in the Query palette. This is where you will completely control the appearance of your graph. Power Painter 205 . From the Properties panel. Report properties.With the Chart Editor (Figure 7-11 on page 206) open. 2010 1:15 pm 7214ch06. Figure 7-10 Show Chart Editor icon 11.Select a graph to open the Basic Chart Properties window (Figure 7-10). you see the basic graph properties or report properties. under the Value column. You define your traffic lighting or conditional styling here. the options that you select control the properties displayed in the properties panel. Chapter 7. If you select a graph or report. And if you click the white space on the canvas outside of a report. you see the overall properties for the document. for Text rotation. c. Click either the Show Chart Editor icon or select View → Palettes → Chart Editor. and Column properties. 10. In the Chart Editor panel. select Ordinal axis and then select Labels.Draft Document for Review January 3. you see the properties that relate to that column. To read all of our region names. You can choose whether one series shows as bars while a second series is displayed as a line chart and much more. b. we must orient them differently on the graph: a. select 45 degrees to present the region names on a 45 degree angle.

Add a heading to the report: a. 2010 1:15 pm Figure 7-11 Chart editor properties 12. d. 206 Getting Started with DB2 Web Query for i . Draw a rectangle where you want to place the heading of your report. Click Font Properties.fm Draft Document for Review January 3. Figure 7-12 Adding text to a report b. c.7214ch06. Type a report title of Sales Analysis by Country. From the Toolbox. select the Text icon (Figure 7-12).

iv. ii. v. Power Painter 207 . select blue for Text Color. Select the Text icon from the toolbar and draw a rectangle where you want to place the text on your report (Figure 7-14). Choose a font.fm e.Add a date and page numbers to the report: a.Draft Document for Review January 3. Under Options. Click OK. Under Size. After the date that you just inserted. press the Enter key to force a new line and type Page. In the Edit Font window (Figure 7-13). Under Style. Figure 7-14 Adding a text box to your document b. Figure 7-15 Inserting current Date/Time c. 2010 1:15 pm 7214ch06. Chapter 7. iii. we choose Arial. Select the Insert → Date/Time and select the date format that you want to see (Figure 7-15). select 14. Figure 7-13 Adding text to a graph 13. select bold and underline. complete these steps: i.

2010 1:15 pm d. Figure 7-18 Font changes 208 Getting Started with DB2 Web Query for i .7214ch06. Click OK.fm Draft Document for Review January 3. Figure 7-17 Date and page numbering area 15.In the Edit Font window (Figure 7-18). Select Insert → Page Numbering → Page n of n (Figure 7-16). Figure 7-16 Inserting page numbering 14.Select the Font Properties button and make your new text the same color as your report heading (Figure 7-17). change the font size to 10 so this text is smaller than the main heading.

If we want to add data from a second data source. When the coordinated column COUNTRY changes.fm 16. Note: We use the same data source that we used for the graph. 2. 1. click the Report icon.Save and run your report. in the Toolbox. we select the Data Sources palette and click the Add data source icon. Notice that you have one page for each graph. W es t er n C an a da Chapter 7. Outline the area under your graph where you want your report to be located on the page. 2010 1:15 pm 7214ch06. we create the coordinated report as explained in the next section. 3. Power Painter 209 . Make sure that your PP1_PDF report is open and maximized.4 Building a report with Power Painter We now add a report that lists each salesperson that sold in the country and details about the sales. In this example. Figure 7-19 shows the results of running the report. 7.Draft Document for Review January 3. It is conceivable that a salesperson’s results are in different sections of the report if they made sales in different countries. Canada 180M 160M 140M Revenue 120M 100M 80M 60M 40M 20M 0 da an a C rn te Ea s Region Figure 7-19 Regional Sales Analysis graph Now that our graph is complete. a page break occurs. There are multiple ways to start a report in Power Painter.

you can select one or multiple fields from the data source list and then drag them to the canvas. 2010 1:15 pm 4. If you have a small table or view. Tip: When creating a report.7214ch06.fm Draft Document for Review January 3. Try it. Drop SALESREP in the By folder. Figure 7-20 Adding fields to a report You can drag fields directly to the report. and places alpha fields in the Sort By folder and numeric fields in the Sum folder. autosizes it. 210 Getting Started with DB2 Web Query for i . Drag SALESREP to the new report area and a Query palette opens. See Figure 7-20. DB2 Web Query automatically creates a region for the report. you can drag the entire table to the canvas and have an instant one-click report. or you can drag them to a query palette that you open and dock.

Figure 7-22 Completed query palette Chapter 7. Figure 7-21 Adding additional fields to the report 6. After you place a column under the Coordinated folder. You do not have to drag COUNTRY under the Coordinated folder. Power Painter 211 . Drag ORDERNUMBER into the By folder (Figure 7-21). Drag the remaining columns as shown in Figure 7-22 onto the Query palette. 2010 1:15 pm 7214ch06.Draft Document for Review January 3.fm 5. You have now specified the columns to use in your query. it is automatically there for every report or graph in your layout.

select No. Highlight SALESREP and go to the Properties pane. i. 212 Getting Started with DB2 Web Query for i . c. ii. for Visible. iv. To do this. In the Current Subtotal Text field. Scroll down. type subtotal for and click OK..) button. The default for a column is to sum or total it. 2010 1:15 pm 7. we need Country as a By column not just a Coordinated column. We do not want to see a column for Country in our report since it is the same on the entire page. Select Country from the Data Sources pane. Figure 7-23 Adding subtotals d. Open the query palette if it is closed. Add the grand totals for each section or country in our report.7214ch06. This can be overridden. and you can request column functions such as average or count. We must hide the column.. Add some subtotals when the sales representative changes and when the country changes. add it as a By column. Highlight COUNTRY under the By folder and go to the Properties display. Open the Query palette if it is closed. but still have the properties available to indicate that subtotaling is desired. b. Also add grand totals at the end of the report: a. select the Sub Totals radio button.fm Draft Document for Review January 3. In the Field properties panel. iii. Scroll down to Subtotal and click the ellipsis (. In the Sub Total Options window (Figure 7-23). and then move it to the top of the By column list. highlight subtotal and click the ellipsis button.

b.fm v. type Grand totals for and click OK. In the Sub Total Options window (Figure 7-24). Power Painter 213 . i. click the Sub Totals radio button. 2010 1:15 pm 7214ch06. Highlight the report and go to the Report properties panel (Figure 7-25). Figure 7-25 Column totals 8. Add the grand totals to the report. The Overflow property controls what happens when the report has too many rows to be displayed in the defined region. the rows continue in the Chapter 7. In the Report properties pane. locate Column totals and select Totals. Highlight the report so that you can work with the Report properties. Figure 7-24 Grand totals for each country e. If the report is longer than the frame that we have drawn. These totals are not associated with any specific column changing but rather with the report itself. The default value of Fixed indicates that the report is restricted to the exact area that you defined. complete these steps: a. ii. If it overflows.Draft Document for Review January 3. Under Current Subtotal Text.

2010 1:15 pm same area on the next page until the report is complete. Next you can add a flow relationship linking the reports location with the graphs in Power Painter. Figure 7-27 Relate Objects Icon 9. Then hold the CTRL key and select the Graph. If you select Flowing. Once each object is selected click on the Relate Object icon as shown in This icon will relate the objects by the order selected. To relate the objects. Save and run your report. the report ignores the vertical boundaries and flows from the top to the bottom of each following page until it is complete. Make sure that the Sizing and Overflow parameter is set to Flowing (Figure 7-26). Figure 7-26 Controlling report overflow c. Figure 7-28 on page 215 shows the results of running this report. 214 Getting Started with DB2 Web Query for i . This relationship is graphically shown as an arrow between the Report and Graph. We want our report to take full pages and flow until it is finished. Related objects will allow multiple flowing reports to be presented without overlapping each other.fm Draft Document for Review January 3.7214ch06. first select the Report object.

Draft Document for Review January 3. Power Painter 215 . From the Query palette under Coordinated.Notice that the report is quite long as indicated by the number of pages at the bottom of the window (“1 of 100”). In the Field properties pane. we have a page break and the report layout starts over again. add a table of contents with an entry every time the COUNTRY changes. select Yes (Figure 7-29 on page 216). 2010 1:15 pm 7214ch06. and for Table of contents.fm Figure 7-28 Page 2 of a flowing report 10. Chapter 7. To solve this problem. Trying to find any individual country can be time consuming. highlight COUNTRY.

Figure 7-30 PDF with a table of contents 216 Getting Started with DB2 Web Query for i . Figure 7-30 shows the results of running this report.7214ch06.fm Draft Document for Review January 3.Save and run your report. 2010 1:15 pm Figure 7-29 Table of contents property 11.

Click on the “Click here to edit" Drill Down option to open the prompt and enter http://www.2.Save the report and run your report. Once the field is highlighted the SALESREP field properties will be toggled into the Properties Panel. 2010 1:15 pm 7214ch06. You have now created your first compound PDF report using Power Painter.Now add a URL drilldown on the SALESREP field in your Power Painter report. “Drill-down reports: Parent report (RA5_Child)” on page 138: Parent report (RA5_Child) discusses how to use Procedural drill downs. Notice the SALESREP field now has a hyperlink on it. Open the Query Panel and select the SALESREP Field. (See Figure 7-29) Note You can also specify the drill down to run a DB2 Web Query Procedure. Power Painter 217 . Click on a hyperlink to see how the URL drill down will open a browser with the dynamic search string. Chapter 7.Draft Document for Review January 3. Section 5. Figure 7-31 URL drill down prompt option in Power Painter 13.fm 12.com/search?(q=COUNTRY) into the URL field.4.google.

select the image you want to add to the layout and click OK as shown in Figure 7-33 on page 219. 218 Getting Started with DB2 Web Query for i . From the list. Follow these steps: 1. 3. Click the Add image icon in the Toolbox as shown in Figure 7-32.fm Draft Document for Review January 3. copy/move the image file to the DB2 Web Query BASEAPP folder. Using a tool such as System i Navigator or Windows Explorer (with mapped drive). 4. Figure 7-32 Add image to PowerPainter layout A dialog window opens that displays all of the image files that reside in the \QIBM\UserData\webquery\ibi\apps\baseapp folder. 2010 1:15 pm 7.7214ch06. this can be easily done using PowerPainter.5 Adding an image If you would like to include an image (such as a company logo) in your layout. This is the following folder in the IFS: \QIBM\UserData\webquery\ibi\apps\baseapp 2. Make sure that your PP1_PDF report is open in Power Painter.

Figure 7-35 on page 220 shows the results of running this report Chapter 7. Figure 7-34 Image added to layout 6. The image appears in the box you outlined as shown Figure 7-34. Outline the area where you want the image to be located on the page. 2010 1:15 pm 7214ch06.fm Figure 7-33 Selec t image file to add 5. Power Painter 219 . Save and run your report.Draft Document for Review January 3.

1.7214ch06. right-click. Also known as a speedometer chart. and select Power Painter. It is a very useful and common in Business Intelligence dashboards. 2010 1:15 pm Figure 7-35 Run report with image 7. In the Open window. Navigate to your Tutorials folder.6 Building a gauge chart Another type of graph that can be built using PowerPainter is a gauge chart. Open DB2 Web Query (if it is closed) 2. select the Cen_Orders table and click OK. this type of chart usually indicates the current position of a value within a given spectrum. Select View → Palettes and make sure the following are checked (as shown in Figure 7-36 on page 221): – – – – – 220 Toolbox Properties Query Data Sources Chart Editor Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. 3. Set up all the necessary palettes. 4.

Chapter 7. Add a new chart to the layout by select the Chart icon in the Toolbox palette (Figure 7-37) Figure 7-37 Add new chart 6. 2010 1:15 pm 7214ch06. then select the gauge chart (first chart in the second row).fm Figure 7-36 Set up palettes 5. From the New Chart dialog window. As shown in Figure 7-39 on page 222.CEN_ORDERS in Query palette).Draft Document for Review January 3. select the funnel chart on the first row (far right). define the gauge chart’s sum column by selecting the LINETOTAL column (under CEN_ORDERS in Data Sources palette) and drag it into Sum (under Chart . An example is displayed in Figure 7-37. Figure 7-38 Select gauge chart 7. Power Painter 221 . Click Finish button 8.

An example is shown in Figure 7-41 on page 223.7214ch06. Figure 7-40 Gauge chart example 9. and selecting Blue Bevel from the drop down list for Gauge background style. Change the gauge background style by selecting General (under the Chart Editor palette).fm Draft Document for Review January 3. 222 Getting Started with DB2 Web Query for i . your work should something like the example shown in Figure 7-40. 2010 1:15 pm Figure 7-39 Define gauge chart’s Sum column At this point.

click on color icon and set Border color to red.fm Figure 7-41 Set gauge background style 10. Minimum value: 0.0 f. Band color should already be set to red. select Band 1 format and make the following changes (as shown in the example in Figure 7-42 on page 224) d.The gauge chart will contain 3 band ranges. Power Painter 223 . Maximum value: 800000000 (or 8. Set up format for first band. Under Gauge axis. If not. If not.Draft Document for Review January 3.0E8) e. 2010 1:15 pm 7214ch06. click on color icon and set Band color to red. Border color should already be set to red. Chapter 7. g.

7214ch06.Set up values for band 2. Maximum value: 1200000000 (or 1.fm Draft Document for Review January 3. Double-click on color icon for Border color and select yellow. Minimum value: 800000000 (or 8. select Band 2 format and make the following changes (as shown in the example in Figure 7-43 on page 225) a. d.2E9) b. 224 Getting Started with DB2 Web Query for i . Under Gauge axis. Double-click on color icon for Band color and select yellow. 2010 1:15 pm Figure 7-42 Set up band 1 11.0E8) c.

2010 1:15 pm 7214ch06. Minimum value: 1200000000 (or 1. select Band 3 format and make the following changes. Maximum value: 2000000000 (or 2E9) b.Draft Document for Review January 3. Power Painter 225 . Double-click on color icon and set Band color to green 13.Finally. a. Double-click on color icon and set Border color to green d. It should look like the example shown in Figure 7-44 on page 226.Save your report as pp_gauge 14.Run your report. Chapter 7.2E9) c. set up the third band.fm Figure 7-43 Set up Band 2 12. Under Gauge axis.

2010 1:15 pm Figure 7-44 Completed gauge chart Note: There is a lot more that you can do in Power Painter. This tutorial has barely scratched the surface. 226 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. and you will have a new report.7214ch06. This gives you a starting point before you continue to add new reports using the Power Painter functionality. Try dragging multiple fields at once on the page. You can also try looking at “relationships” and using the advanced graphics. You can open any Report Assistant or Graph Assistant report in Power Painter.

Draft Document for Review January 3, 2010 1:16 pm

7214p03.fm

Part 3

Part

3

Tutorials for DB2 Web Query optional features
In Part 2, “Tutorials for DB2 Web Query” on page 87, we cover the base features that are included in DB2 Web Query. In this part, we cover the optional components that are ordered as feature codes for 5733-QU2. This part includes the following chapters: Chapter 8, “Active Reports” on page 229 Active Reports enable the analysis of reports by users even when they are not connected to the System i platform. Chapter 9, “Developer Workbench” on page 249 This chapter is a prerequisite for both Chapters 10 and 11. Chapter 10, “Online analytical processing” on page 257 The graphical hierarchy or dimension design components of Developer Workbench are a prerequisite for OLAP-enabling your reports. After you define these hierarchical structures, it is simply a matter of the report developer including them in the existing reports. Chapter 11, “HTML Composer” on page 289 HMTL Layout Painter is a component of Developer Workbench. With it, you can create compound reports, dashboards, and highly parameterized reports. Chapter 12, “Additional features of Developer Workbench” on page 343 Developer Workbench is a set of advanced tools for programmers. This chapter includes information about advanced metadata definition, data profiling, impact analysis, SQL wizards, and business view creation of your data. Chapter 13, “DB2 Web Query Spreadsheet Client” on page 377

© Copyright IBM Corp. 2009. All rights reserved.

227

7214p03.fm

Draft Document for Review January 3, 2010 1:16 pm

228

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:15 pm

7214ch07Act_Rpt.fm

8

Chapter 8.

Active Reports
Active Reports is an optional feature that is available from IBM for DB2 Web Query. While the base product is licensed to named users, Active Reports is licensed to a System i machine, based strictly on the software tier (P10, P20, and so on). Any user who can create a report using either Report Assistant, Graph Assistant, or Power Painter is entitled to create an Active Report. Since Active Reports is intended for disconnected users, individual users do not require a license to use the reports. The HTML reports must be made available to users either by e-mail, a shared network drive, or additional tools, such as Report Caster, from Information Builders. As you will see in this chapter, with Active Reports, the data and the reporting controls are all stored within the HTML page. When the user has access to the HTML page, the user can access, manipulate, and analyze the data with no requirement for any additional licensing. With Active Reports, for example, a sales person might sign on to the System i environment in the morning and run a report for each customer they plan to visit that day. Then they can save the reports on their local hard drive. From their car, the sales person can then look at and analyze the data for their customer immediately prior to visiting them. Attention: To use Active Reports, the server requires a license key that can be purchased as an optional feature of DB2 Web Query (5733-QU2).

© Copyright IBM Corp. 2009. All rights reserved.

229

7214ch07Act_Rpt.fm

Draft Document for Review January 3, 2010 1:15 pm

8.1 Overview and highlights of Active Reports
Active Reports allows users to interact with their reports and work disconnected from the System i environment. HTML Active Report pages are self-contained reports. Both the data and the Java Script are compressed within a single efficient file. This file can be stored by the users on their local drive. It can be stored on the server for retrieval by the users or it can be sent by e-mail to users. Active Reports are well suited for the mobile worker who is frequently disconnected from the Web. With Active Reports, you can create a variety of simple or advanced charts (pie, line, bar, or scatter), roll-up analysis, or pivot reports. You might want to allow your sales people to analyze the buying patterns for the clients they intend to visit that day. Your service personnel might want to view the service history of a customer before they visit. You might even choose to send reports by e-mail to your customers or partners that detail their activities with you. The user of an Active Report requires no special software, and there are no licensing fees for users. With Active Reports, users can perform the following tasks: Create graphs and charts based on their data Filter or highlight their data Change the report sort sequence to any column Apply calculations such as sum, min, max, avg, count and count distinct to their data Change the look of a report by hiding columns, changing the pagination, and more Add data visualization bars to compare and contrast values in a column Users can continue to work with their reports in a browser window, download the reports to Microsoft Excel, or even pull their data and graphs directly into Microsoft PowerPoint®. Figure 8-1 on page 231 shows a sample of the output generated from Active Reports.

230

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:15 pm

7214ch07Act_Rpt.fm

Figure 8-1 Active Reports sample

8.2 Creating a report with Active Report
We enable the RA3_GrossPft report that we created in Chapter 5, “Report Assistant” on page 97, to be used when the user is not connected to the server. Important: Prior to beginning this tutorial, you must have upgraded your license key. The only requirement for Active Reports is that the server be properly licensed. There are no user requirements. 1. From the DB2 Web Query home page, open the RA3_GrossPft report. 2. Click the Report options tab.

Chapter 8. Active Reports

231

7214ch07Act_Rpt.fm

Draft Document for Review January 3, 2010 1:15 pm

3. On the Report options tab (Figure 8-2), complete these steps: a. For Generate report as, select AHTML - Active Report. When you select this option, notice that the Active Report Styling button becomes active. At this point, you might run the report. However we a make a few formatting and highlighting changes first. Note: Horizontal (Across) sort fields are not supported for HTML Active Reports. b. Click the Active Report Styling button.

Figure 8-2 Selecting the Active Reports option

232

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:15 pm

7214ch07Act_Rpt.fm

c. In the Active Report Styling window (Figure 8-3), under Report view, select Tabular. For Row selection, select yellow. For Visualization colors, select red for Negative and dark green for Positive. Click OK. Note: In this window, we define the presentation and initial look of the report for the user. We discuss Accordion reports later in the tutorial.
.

Figure 8-3 Active Report Styling

4. Save your report as AR1_GrossPft. 5. Run your report. Figure 8-4 shows the results of running the report.

Figure 8-4 Active Reports in the tabular format

Chapter 8. Active Reports

233

7214ch07Act_Rpt.fm

Draft Document for Review January 3, 2010 1:15 pm

6. Click a down arrow next to any column and select Save Changes (Figure 8-5). Save your report as AR1_GrossPft.html. Note: You can also use the Save As option in your browser to save the HTML page. If you choose the Export option instead of the Save Changes option, you export the records without formatting and controls. The records can be exported to an HTML page, Excel, and comma separated values (CSV) files.

Figure 8-5 Saving your Active Report for offline use

Tip: After you save your report as an HTML file, you can send it to users by using e-mail. In this case, the recipient can view and analyze the report with no connectivity to the System i environment. To run and save an Active Report, you must be a named user. To work with the HTML file after it is created, you do not need to be a named user. In the next section, we continue to work with this Active Report, but we do this so as though we are the disconnected user and not the developer.

234

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:15 pm

7214ch07Act_Rpt.fm

8.3 Using an Active Report
When a user receives an Active Report, they open it in their browser. After your users receive this report, they can then perform various types of analysis on it without connecting to the System i environment. ActiveX® controls: Active Reports use ActiveX controls. Based on your browser security settings, you might see warning messages, and you might be asked if you want to allow blocked content. 1. Locate and open the AR1_GrossPft.html report. If you are connected to the System i environment, you can also go to the DB2 Web Query home page, navigate to the report, and run the report. 2. Analyze the product categories and evaluate the gross profit compared with revenue or Line Total. Click the down arrow next to Gross Profit and select Sort Descending (Figure 8-6).

Figure 8-6 Active Reports Sort Descending

3. To make the report fit better on the page, we hide the Cost of Goods Sold column. To hide a column, click the down arrow next to Cost of Goods Sold and choose Hide Column (Figure 8-7).

Figure 8-7 Hiding columns

Chapter 8. Active Reports

235

7214ch07Act_Rpt.fm

Draft Document for Review January 3, 2010 1:15 pm

4. The Visualize feature is a powerful tool that allows you to see, at a glance, relationships between various columns. Click the down arrow for the Gross Profit column and select Visualize. See Figure 8-8.

Figure 8-8 Active Reports Visualize Selection

Notice the green or red bars that are displayed in the chart in Figure 8-9. Visualize gives you a quick visual representation of the data in a column. 5. Click the down arrow for the Revenue column and select Visualize. Now you see the bars for the Revenue column as well. With the visualize bars, it is much easier to spot relationships. Notice that although speakers is not ranked high in the Revenue column, they are extremely profitable and generate the third highest profit of any product category.

Figure 8-9 Active Reports Visualize results

6. Click the down arrow for Gross Profit. Select Calculate → % of Total (Figure 8-10). 236
Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:15 pm

7214ch07Act_Rpt.fm

Figure 8-10 Adding a % of Total column

Chapter 8. Active Reports

237

7214ch07Act_Rpt.fm

Draft Document for Review January 3, 2010 1:15 pm

Notice that a new column, called % of Total, is now displayed that shows each product category row as a percent of the total Gross Profit in this report (Figure 8-11). 7. Click the down arrow for Gross Profit and select Sum. Your summary prints at the top of the page by default.

Figure 8-11 New % of Total column and Total Sum

238

Getting Started with DB2 Web Query for i

you can search for a string of data anywhere within a field using the Contains operand. such as Greater Than and Equal. Click the down arrow for Product Type and choose Filter → Equals (Figure 8-12). your report contains all the records. If case is important. Filter the report temporarily so that we can concentrate on our audio sales. click the down arrow on the right to see a list of the distinct values in a field. but highlights the ones that meet the filter criteria. Highlight button: If you click the Highlight button instead of clicking the Filter button. there is an additional operand Contains (match case). Select Audio from the list. Contains is not case sensitive. There are also similar Omits and Omits (match case) options. Figure 8-12 Active Reports filtering 9. In the Filter Selection window (Figure 8-13). Then click Filter. Chapter 8.Draft Document for Review January 3.fm 8. Active Reports 239 . Figure 8-13 Active Reports Where Equals clause Contains operand: Besides your standard operators. 2010 1:15 pm 7214ch07Act_Rpt. By default.

It enable you to cycle through viewing the sum of all your data. you can choose the Restore Original option. Select the down arrow for Gross Profit and select Rollup → Group By Product Category (Figure 8-15).In the filtered chart (Figure 8-14). and having both sums displayed concurrently. click the new SUB/TOT icon. At any point.7214ch07Act_Rpt.fm Draft Document for Review January 3. Figure 8-14 Active Reports Filtered/Total Sum 11. close the Filter Selection window. In the upper left corner.A helpful way to analyze the data involves changing the grouping and looking at your numbers slightly differently. 2010 1:15 pm 10. you see both your filtered sum and the total sum for a column. the sum of your filtered data. To see all the records. Figure 8-15 Active Reports Rollup grouped by Product Category 240 Getting Started with DB2 Web Query for i .

displaying the filtered data.Click the Pie chart graph icon to change the report that you are looking at into a pie chart (Figure 8-16). Click the first List type icon and select Export to → Excel (Figure 8-17). Active Reports 241 . and Product Category as your Group by field. 2010 1:15 pm 7214ch07Act_Rpt. Figure 8-17 Active Reports graph You can access the same graph directly from your full report by clicking the Gross Profit column. select the Lock icon. Pie. To keep the chart as is. You can choose line or bar charts as well. and Word. then plotted your graph.fm 12.Export the chart to Microsoft PowerPoint.Draft Document for Review January 3. Tip: If you created filters. and closed the filter. by default. selecting Chart. Excel. Figure 8-16 Active Report rollup results 13. Chapter 8. your graph changes to reflect the displayed report or all the data.

fm Draft Document for Review January 3.Close Excel and close the charting window. select the down arrow for Gross Profit and select Rollup -> Product Type as the field to Rollup as shown in Figure 8-19. 242 Getting Started with DB2 Web Query for i .To use the Rollup functionality. Figure 8-19 Rollup Gross Profit by Product Type 17.Once a Rollup window is open you can add another measure using Add(Y). 16. This will add the Revenue field to the Rollup window.Export to the other Microsoft product if you have them loaded on your system. Click on the Add Icon -> Add(Y) --> Revenue as shown in Figure 8-20 on page 243. 15. Figure 8-18 Active Reports output to Excel 14. to add Revenue to this Rollup window.7214ch07Act_Rpt. 2010 1:15 pm Figure 8-18 shows the output of the report to Excel.

18. select the down arrow for Gross Profit and select Pivot → Product Category → Product Type as the field to go across the top of your table (Figure 8-21).fm Figure 8-20 Add Y Function Note: You can also add new Grouping Fields to the Rollup Window using the Group By (X) selection as shown in Figure 8-20. 2010 1:15 pm 7214ch07Act_Rpt.To use the Cross tab or Pivot functionality. for us to pivot on. There are not enough fields shown that relate to each other. The next steps illustrate additional capabilities of Active Reports. Figure 8-21 Creating pivot tables with Active Report Note: This report is not a good one to demonstrate cross tab or pivot functionality. Chapter 8. Active Reports 243 .Draft Document for Review January 3.

You might ask to see the average profit numbers. Figure 8-23 Changing sort breaks and sort priorities for Active Reports There is quite a bit more that you can do with pivot tables if it makes sense for your data. pivoting on that field. if you have more than one record per row grouped together. Tip: To size the window shown in Figure 8-23 on page 244. Click once outside the box after you finish dragging to release the cursor. changing it. Figure 8-22 Pivot Table output with Active Report Clicking the icon to the left of the arrow moves a field back and forth between being a column or a row. you can start adding to it. Click the left (circled in Figure 8-22) icon above Product Type. and pivoting it. for example.7214ch07Act_Rpt. Notice in Figure 8-23 that the title changes as the column layout changes. scroll down to the bottom of the window. 244 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. 2010 1:15 pm 19. In the right corner is an area that you can drag to widen and size the pivot table.When you have a basic pivot table.

Click the Field selection tab (Figure 8-24). complete these steps: a. b. Remove subtotals from PRODUCTTYPE. If your report definition is closed. Restriction: With earlier versions of the software. go to the DB2 Web Query home page navigate to it. 5. complete these steps: a. Select Accordion instead of Tabular and click OK. Active Reports allow users to quickly add a level of analysis to their reports.fm As you can see. all without being connected to the System i environment. and open it. 3. Figure 8-24 Removing subtotals and selecting the option to add grand totals to the end of the report 4. Chapter 8. b.Draft Document for Review January 3. It is easiest to remove them now. 2010 1:15 pm 7214ch07Act_Rpt. subtotal and total messages occasionally appeared in an accordion report. Click the Report options tab. Clear the Add grand totals to the end of the report check box. On the Report options tab. right-click. Click the Active Report Styling button. On the Field selection tab. Active Reports 245 . 2. Let us look at the difference between a tabular and accordion Active Report: 1.

000 rows of data. to HTML files and directly into Excel. Click the plus sign (+) to expand a field. Tip: HTML Active Reports can support up to 20. Run your report. we could expand each of the levels. If you are using an Internet Explorer browser. Figure 8-25 shows the results of running the report with the Accordian option selected. In our example.fm Draft Document for Review January 3. If you are using a Firefox browser.7214ch07Act_Rpt. Figure 8-26 Accordion format in Active Reports 8. Figure 8-25 Accordion Active Report 7. Look at some of the other options that are available under the arrows. you have the choice of exporting the entire data set or just the filtered records. use only 5. If you filter your data.000 rows of data. Click the minus sign (-) to compress the data. 246 Getting Started with DB2 Web Query for i . we expand Audio and see all the Product Categories within Audio (Figure 8-26).000 rows of data. You will see that you can export data to CSV files. 2010 1:15 pm 6. we recommend that you use only up to 15. If we had more Sort By columns in our report. Only the data values at the highest level (first vertical sort field) are shown initially.

Even with local users.fm 8.Draft Document for Review January 3. You can create an Active Report and send it by e-mail it to a user for the user to analyze it. Chapter 8.4 Summary Active Reports is a tool that works extremely well when your users are remote and not connected to the System i environment. 2010 1:15 pm 7214ch07Act_Rpt. Active Reports 247 . Active Reports is just one more powerful reporting tool for you to use with DB2 Web Query. The person who originally runs the report must be a licensed named user. there are no named user licensing requirements to work with and analyze an Active Report. The report is stored in a highly compressed format.

2010 1:15 pm 248 Getting Started with DB2 Web Query for i .7214ch07Act_Rpt.fm Draft Document for Review January 3.

We might want to know if these five records are a quality problem. © Copyright IBM Corp. Profiling allows you to see patterns in the text characters. One of the major tools within Developer Workbench is the HTML Composer component. and Chapter 11. “Online analytical processing” on page 257. “Additional features of Developer Workbench” on page 343. If you plan on using the optional online analytical processing (OLAP) feature. For example. Developer Workbench Developer Workbench provides an integrated development environment (IDE) for building and maintaining a DB2 Web Query reporting environment. “HTML Composer” on page 289. convert date formats. 249 . you can see which reports and graphs use that field and the business views that it is part of. “HTML Composer” on page 289. 2009. The Synonym Editor allows you to change the way a field is displayed to the users. convert alpha to numeric fields. HTML Composer is specifically designed to create HTML pages that can contain compound reports or dashboards. Data profiling also shows the minimum and maximum values in a column and identifies the outliers. 2010 1:16 pm 7214ch08MRD. you must define your hierarchies or dimensions with Developer Workbench. For more information about Developer Workbench. In this chapter. or even change the length of a field. The SQL Wizard allows you to import SQL into Report or Graph Assistant. Developer Workbench provides the capability to “profile” your data. see Chapter 12. You can add commas and decimal signs. Developer Workbench provides the ability to perform impact analysis at both a file level and a field level. You can predefine joins for the users or create business views that simplify the structure and number of columns the user sees. Using the metadata layer. Developer Workbench includes additional tools to work with your metadata. All rights reserved. This chapter is a prerequisite for both Chapter 10. You can find a complete tutorial for this component in Chapter 11.Draft Document for Review January 3. profiling telephone numbers in the Stores table might show us that five records have a format of nine numeric characters instead of ten. If you must make changes to a field.fm 9 Chapter 9. The Synonym Editor also allows you to create calculated fields for users. we configure the System i DB2 Web Query environment and set up some Developer Workbench default settings.

a.7214ch08MRD.1 Configuring Developer Workbench To configure Developer Workbench: 1. install the software on the developer’s PC.fm Draft Document for Review January 3. Right-click WebFOCUS and select Add (Figure 9-1). 2010 1:16 pm 9. add a definition for your System i environment. Figure 9-1 Adding System i environment 250 Getting Started with DB2 Web Query for i . 2. Because Developer Workbench is a PC application. When you start Developer Workbench the first time.

ensure that it is /webquery_html. verify that 11331 is selected.fm b. Type a description of your System i environment. complete these steps: i. For Host Name/IP Address. type a name. For HTML Alias. For Port. iii. ii. you must clear the Use Default box and specify your installation’s port number.Draft Document for Review January 3. Figure 9-2 System i environment properties Chapter 9. 2010 1:16 pm 7214ch08MRD. iv. In the next window (Figure 9-2). v. Tip: If you changed the default DB2 Web Query default port number. Click OK. Developer Workbench 251 .

fm Draft Document for Review January 3. Tip: Select the Remember my User Name and Password on this computer option in this sign on and the next sign so that you are not prompted with these sign-on windows again for this System i connection. The first time that you open the System i environment or connection that you just added.7214ch08MRD. See Figure 9-3. 2010 1:16 pm 3. Figure 9-3 Initial opening of the System i connection 252 Getting Started with DB2 Web Query for i . Sign on with your administrator or developer authorized profile. Click Logon. you must sign on.

Chapter 9. Enter your user name and password and click Logon. Expand system name → Data Servers → EDASERVE (Figure 9-4). 2010 1:16 pm 7214ch08MRD. Continue down the metadata path by expanding EDASERVE → Applications.fm 4. Figure 9-4 Metadata login 6. Select baseapp. Log on again. 5. Developer Workbench 253 .Draft Document for Review January 3.

The access file contains information about the actual name and location of the physical table and the primary keys for the table. You expand that branch if you want to create a new report or modify an existing one. Remember that the master file contains the field names and formats for your table. The source code or procedures that store your report definitions are located under the Managed Reporting → Domains portion of the tree. We use the tailoring options in later tutorials. Nearly all your work is done with the master file.7214ch08MRD. Figure 9-5 Metadata files 9.fm Draft Document for Review January 3.acx) files. 2010 1:16 pm In the right pane of Figure 9-5.2 Setting Developer Workbench default options Developer Workbench has a set of options that can be tailored to an individual user.mas) and access (. you see all your metadata or your master (. select Window → Options (Figure 9-6). Figure 9-6 Displaying Developer Workbench options 254 Getting Started with DB2 Web Query for i . To access these options.

fm Figure 9-7 shows the General options tab. Figure 9-7 General options tab Restriction: Report Assistant does not pick up all the reporting options set under the Reporting tab at this point in time. On the Explorer tab. the better. The obvious benefit is the ability to stay within one working environment as a programmer. Showing your Windows desktop tree within Developer Workbench has a definite benefits. company logos. You might want to move style sheets. pictures. you select the Show Desktop on Explorer tree option (Figure 9-8). Developer Workbench 255 .Draft Document for Review January 3. An additional benefit is the ease with which you can copy items from your PC hard drive to the DB2 Web Query folder structure. 2010 1:16 pm 7214ch08MRD. and other PC files between the different file structures. Figure 9-8 Explorer options Chapter 9. The less that you have to flip back and forth between your development mode and Windows. Developer Workbench allows you to show your Windows desktop explorer tree in the same window as your DB2 Web Query explorer tree.

7214ch08MRD. Figure 9-9 Copying files between the PC and DB2 Web Query For more details about using Developer Workbench. “HTML Composer” on page 289 Chapter 12. we copy and paste a text file that contains SQL statements into our Other Files folder in the Common Domain. “Additional features of Developer Workbench” on page 343 256 Getting Started with DB2 Web Query for i . From here. “Online analytical processing” on page 257 Chapter 11. refer to the online help text and the following chapters: Chapter 10. 2010 1:16 pm In Figure 9-9. the SQL can be accessed and run via the SQL Wizard in Developer Workbench or the SQL metadata creation option from the DB2 Web Query home page.fm Draft Document for Review January 3.

This automatically provides an interface with drop-down lists and drill capable columns that allow the user to slice and dice or pivot their data and perform a variety of local analysis on the original report. A user could have created a separate ad hoc query for each of the above questions but that would probably not occur in real life.fm 10 Chapter 10. If a user simply had to click a specific field of interest to go down to the next level of detail. This type of analysis is sometimes called “Having a conversation with your data”. After this is done. After taking a standard report created with Report Assistant. slice and dice interface without the report developers having to do anything at all. 2009. If you then find that a single state is pulling down the region you might ask to see the revenue for that state split out by the different product groups you sell.Draft Document for Review January 3. 2010 1:16 pm 7214ch09OLAP. You will have a better understanding of this concept by the time you finish this tutorial. the report developer selects an output option to OLAP-enable the report. After you find a product group that appears to be in trouble. the users have an easy and intuitive way to navigate and drill down on the hierarchy within their data. you might ask to see the sales for that product group in that state summarized by month for the last two years. DB2 Web Query makes it easy to provide users with a sophisticated drill-down. It is OLAP technology that enables this quick and easy interaction with the data. © Copyright IBM Corp. they would be far more likely to continue with their analysis. Online analytical processing Online analytical processing (OLAP) is best known as the technology that allows a user to “slice and dice” their data or drill down into their data. All rights reserved. 257 . Tables must have any embedded hierarchies predefined via the Developer Workbench. OLAP analysis typically starts with a question such as “What were my regional sales numbers across the United States?” At this point. you might look at the numbers and ask to see the details for the Eastern region which looks out of line with the other regions.

If you wanted the various years across the top of your report instead. The user can click the hyperlinked column to initiate an action. but they do not need to be. and City. The standard action that is linked to a column is the ability to drill down to the next level of data. A hyperlink can also take you to another report as previously demonstrated. For example. A column that is displayed in blue in a report. This is the specific intersection or slice of the data in which you are interested. it takes precedence in an OLAP report over drilling down through the hierarchy. which is in a Region. 2010 1:16 pm 10. For example. In this example. if a user drills down on Country. you pivot the field or heading “Year”. Drill down An action that involves going from one level in a hierarchy to the next lower level. in an earlier tutorial. For example. Normally these fields are summed or totalled. For example. For example. a Geographic dimension might include a City that belongs to a State. which is part of a Country. Hierarchy Hyperlinks The structure or sequence of each of column within the dimension. we drilled down on Product Type and passed the Product Type as a parameter to a second report. the States that compose the region are displayed. Numeric fields that you want to analyze at the various levels of a hierarchy and at various intersection points. Country is the top level and City is the bottom level of the dimension. In the example. profit is an average measure. above the Geography dimension is a hierarchy of Country.1 OLAP terminology Table 10-1 covers basic OLAP terminology so that you understand the concepts that we use in this chapter. you might want to report your revenue by Country and then drill down to the revenue in the regions that make up the Country. not a summed or totaled measure. If this type of drill down is defined for a column. To move a field from a column to a row or vice versa. which contains multiple Models and each Model contains multiple part numbers or SKUs. they see the different Regions that make up the country. Year might be one of the “by” fields where the different years are listed down the side of your report. you might want to analyze sales of video equipment in the United States. Now the revenue is summed by Region. If they then drill down on Region. Drilling down can also involve invoking more detailed reports or graphs. State. Region.fm Draft Document for Review January 3. In this case. Measure Pivot 258 Getting Started with DB2 Web Query for i . A Product dimension might include Product Type at the top level and below that a Product Category. Table 10-1 OLAP terminology Term Dimension Definition A set of columns structured in a hierarchy.7214ch09OLAP. You might also want to see the average profit on an order across States or Regions to see if certain areas are offering too deep a discount. You can do this in multiple ways in an OLAP report including dragging the field or using the control panel to pivot your data. For example.

2010 1:16 pm 7214ch09OLAP. although the norm is to have a single hierarchy composed of columns from a single table. Before a user can OLAP enable a report. a. also known as dimensions.mas table and select Edit in Synonym Editor (Figure 10-1). a developer must define any hierarchies that are present in the data. Important: Prior to reading this section. Right-click the cen_orders. Figure 10-1 Developer Workbench metadata Chapter 10. “Developer Workbench” on page 249. To define a hierarchy. Expand DB2 Web Query Environments → system name → Data Servers → EDASERVE → Applications → Baseapp. 2. edit the metadata for a table using the Synonym Editor.2 Defining OLAP metadata using Developer Workbench Before a user can successfully OLAP enable a report. Start Developer Workbench. 1.Draft Document for Review January 3. Online analytical processing 259 .fm 10. This hierarchy is automatically used by DB2 Web Query whenever any future user asks to OLAP enable a report that references tables that contain these hierarchies. can involve elements from multiple tables. Hierarchies. you must read Chapter 9. 3. Remember that the term synonym is synonymous with metadata. the tables used must have any existing hierarchies or dimensions defined to DB2 Web Query.

and Stores tables.7214ch09OLAP. DB2 Web Query automatically pulls in the metadata for all four tables into one “clustered” table. Plant. Plant. Inventory.fm Draft Document for Review January 3. Note: In the left pane of this window are four tables pane—Orders. 2010 1:16 pm 4. click the Modeling View button. When you do this. and Stores—even though you only opened the master file or metadata for the Orders table. At the bottom of the window that opens (Figure 10-2). This tells you that the Orders table was defined in the System i environment with foreign keys pointing to the Inventory. This is the easiest way to define hierarchies to DB2 Web Query. Figure 10-2 Developer Workbench Synonym Editor 260 Getting Started with DB2 Web Query for i .

you see the tables and their relationship to the base table Orders. Figure 10-3 Dimension Builder Chapter 10. click Synonym → Dimension Builder. Figure 10-3 shows the Dimension Builder pane. 2010 1:16 pm 7214ch09OLAP.fm 5. To the right of the Dimension Builder view (Figure 10-3). If Dimension Builder is not visible. Online analytical processing 261 .Draft Document for Review January 3.

you have models. Figure 10-4 Icon or detailed table view 7. The level hierarchy is the example that we have used so far.fm Draft Document for Review January 3. You can double-click the icon again to revert back to icon mode.7214ch09OLAP. 262 Getting Started with DB2 Web Query for i . 2010 1:16 pm 6. We must describe this hierarchy to DB2 Web Query. within product types. Regions. Tip: A quicker way to achieve the same result is to click the hierarchy icon (circled in Figure 10-5) at the top of the Dimension Builder pane. State. You can either view the tables as icons or view a column list for each table. The columns in the Inventory table are structured so that. you have product types. Double-click the Inventory table icon to switch to column view (Figure 10-4). and within models. see the Developer Workbench help text. that is Country. Right-click Dimensions and select Add Hierarchy → Levels (Figure 10-5 on page 263). you have product names. within product categories. There are two types of hierarchies one is based on levels and the other is based on parent child relationships. We use level hierarchies. For more information about the different types of hierarchies. and City are a level hierarchy.

Draft Document for Review January 3. Repeat this action for Product Category and Product Name (Figure 10-6). Change the name to Product Hierarchy. drag the column name to Product Hierarchy. Figure 10-6 Product Hierarchy Chapter 10. Right-click your new dimensions icon and select Rename. Online analytical processing 263 . Starting at the top of the hierarchy (Product Type). 9.fm Figure 10-5 Adding a hierarchy 8. 2010 1:16 pm 7214ch09OLAP.

c. Change the name to Plant Hierarchy. Plant State. Drag the column name to the Date Dimension for ORDERDATE_YEAR. Right-click your new dimensions icon and select Rename. Drag the column name to Store Hierarchy for COUNTRY. Right-click your new dimensions icon and select Rename.fm Draft Document for Review January 3. Figure 10-7 Date Dimension 11. Right-click Dimensions and select Add Hierarchy → Levels b. and Store Name. c. Right-click Dimensions and select Add Hierarchy → Levels b. STATE. Change the name to Store Hierarchy. Drag the column name to Plant Hierarchy for Plant Country. CITY. REGION. and Plant City. Right-click Dimensions and select Add Hierarchy → Levels b. Change the name to Date Dimension. 2010 1:16 pm 10. a. Right-click your new dimensions icon and select Rename.Define the Date Dimension shown in Figure 10-7: a. ORDERDATE_MONTH. ORDERDATE_QUARTER. 264 Getting Started with DB2 Web Query for i .7214ch09OLAP. Plant Region. c. 12.Define the Store Hierarchy as shown in Figure 10-8 on page 265. and ORDERDATE_DAY.Define the Plant Hierarchy as shown in Figure 10-8 on page 265: a.

Chapter 10. decompose your date as explained in 12. Developer Workbench is the only interface for defining the hierarchies that are required by OLAP.Save your definition. Developer Workbench. 14. 2010 1:16 pm 7214ch09OLAP.1. Typically this is done once by the IT department. is a prerequisite for creating OLAP-enabled reports. also an optional feature. any user with authority to create reports can choose to OLAP-enable their report. Note: OLAP is an optional feature with DB2 Web Query. “Date Decomposition” on page 348.fm Figure 10-8 Developer Workbench Multiple hierarchies for OLAP 13.1. After this. As you have just seen. Online analytical processing 265 .Draft Document for Review January 3.If you do not see the additional date fields such as ORDERDATE_YEAR. You have now completed the all the definitions that are required for OLAP-enabling your reports. You can see how easy it is to define a hierarchy in your data and create the necessary metadata to OLAP-enable your reports for detailed analysis.

Navigate to your Tutorials folder. On the Report options tab. drag and drop columns. Figure 10-9 Turning off default page numbering b.3 Enabling an OLAP report (OL1_Revenue) To enable an OLAP report: 1. It tends to look messy when you have too many levels within different dimensions. select Show Tabbed. There is no top Selection pane. Show Tabbed: For OLAP reports that have multiple dimensions. Show filters on top/bottom: Adds the OLAP Selections pane to the top (or bottom) of the report. There is no top Selection pane and there is no access to the OLAP Control Panel. hide. 266 Getting Started with DB2 Web Query for i . Enable OLAP options: The Enable OLAP options control how users can interact with an OLAP report and access OLAP tools: Off: Provides an OLAP button to open the OLAP Control Panel. right-click the RA1_Revenue report. 2. and select Open. This option is acceptable with a few dimensions and a few levels in each hiearchy. complete these steps: a. 2010 1:16 pm 10. Columns with panel: Looks the same as Columns only. Under the Enable OLAP. Click the Report options tab. you open the OLAP Control Panel.7214ch09OLAP. select Off (Figure 10-9). This is the option we use. Columns only: Allows you to sort. Show Panel in Report: Is the same as the Columns with panel option but includes a small OLAP symbol in the lower left to more obviously allow the user to open the OLAP Control Panel. 3. Try it to see the difference between showing dimensions and hierarchies as filters or as tabs. Since we know this is a small report. but when you click the square blue button over a dimension.fm Draft Document for Review January 3. this option groups the dimension elements under a tab labeled with the dimension name. for Page numbering.

the user can drill down on the measures within the report. When creating your own reports.fm c. Under the Automatic drill down. Figure 10-10 OLAP enabling a report 4. 2010 1:16 pm 7214ch09OLAP. To summarize. Save your report as OL1_Revenue. Online analytical processing 267 . select Dimensions and Measures (Figure 10-10). Chapter 10. Dimensions: The user can drill down on a dimension to proceed to the next level down in the hierarchy.Draft Document for Review January 3. Automatic drill down options: None: The user cannot drill down to a lower level in the hierarchy within the report itself. This simple selection automatically gives you an enormous amount of analysis capabilities as you will see in the next section. you can choose to drill down on the dimensions only and not the measures. Dimensions and Measures: In addition to drilling down on the dimensions. You have now OLAP enabled your report. we took a basic report and selected an output option to enable OLAP. This gives you the maximum drill-down capabilities. This allows the users to drill down to the lowest level of all displayed hierarchies.

the control panel starts as hidden or closed. This sends your report to a new browser window. dicing. There are three ways to work with your OLAP data: From the report itself From the Selections pane From the Control Panel In the report shown in Figure 10-11. there is a maximize icon to the far right. This is called the Selection pane. The arrows allow you to sort the measures or numeric fields. You also have the capability to work with the measures and to create graphs directly from the report. Figure 10-11 shows this report. there are multiple ways to accomplish the same end result. 2010 1:16 pm 10. Figure 10-11 OL1_Revenue report 10. It includes tabs for every dimension described for any of the tables that are part of the Orders cluster. In this example. You can open it by clicking the OLAP button or by clicking the blue square to the left of the Product Type heading. Tip: When working with an OLAP-enabled report.4 Working with an OLAP-enabled report To begin working with the OLAP-enabled report as explained in this tutorial. and drilling down for more details Looking at the report in Figure 10-11. notice that the heading for every column either has a blue square or a set of arrows. you cannot see the control panel.4. Notice the addition of a completely new panel at the top of the report.fm Draft Document for Review January 3. 268 Getting Started with DB2 Web Query for i . It also allows you to open up the OLAP Control Panel. run your OL1_Revenue report. Note: If you run your report from the DB2 Web Query home page.7214ch09OLAP. The blue square allows you to drag and drop the column and to rearrange or pivot it.1 Slicing.

Because Revenue was previously unsorted. Click this arrow. 2010 1:16 pm 7214ch09OLAP. Click the sort arrow to the left of Revenue (Figure 10-12).Draft Document for Review January 3. Figure 10-14 Revenue context menu Chapter 10. neither half of the arrow is dark and the prompt reads “sort Revenue”. Figure 10-13 Sorting from highest to lowest Here is another way to sort Revenue. Online analytical processing 269 . and you sort the column in descending sequence (Figure 10-13).fm To use the arrows and buttons to drill down for more details. Right-click the column heading Revenue and select Visualize (Figure 10-14). hover over the column again. follow these steps: 1. Now that you have sorted by Revenue. Notice that the bottom half of the arrow is dark. Figure 10-12 Sorting a measure 2.

fm Draft Document for Review January 3. Note: Positive numbers are visualized with blue bars. To start to filter and drill down on your data. each of the drop-down lists contains all the unique values for that column. initially every region in the world is available under the Region tab. click the Country drop-down list and select United States (Figure 10-16). By default. For example. See Figure 10-15. selecting Visualize displays bars to help you quickly note trends or to easily compare two columns. The Store Hierarchy tab has a drop-down tab for each element in the hiearchy.7214ch09OLAP. 4. Tip: You can select multiple values using the Ctrl or Shift keys. Figure 10-15 Revenue visualization 3. 2010 1:16 pm As we saw in Active Reports. proceeding from the top of the hierarchy to the bottom. Figure 10-16 Selecting a hierarchy 270 Getting Started with DB2 Web Query for i . Click the Store Hierarchy tab. while negative numbers are visualized with red bars.

Select the North region (Figure 10-17). 2010 1:16 pm 7214ch09OLAP. Click the Region drop-down list. Click the Reset button to reset the report back to its initial state. Notice that the only regions displayed are for the United States. Your report now shows the revenue and number of orders for the North region in the United States. Figure 10-17 Continuing to filter within hierarchy 6.Draft Document for Review January 3. Online analytical processing 271 . Click the button multiple times to cycle through your choices. Click the = button. Review your current totals and click Run (Figure 10-18). Each time you fill in a value. You can also use the back arrow on our browser to go back one page at a time. The filters in the Selection pane do not take effect until you click Run. 8. Figure 10-18 Run your filtered report 7. Click the Product Hierarchy tab (Figure 10-19). you filter your data by creating a WHERE clause. Notice that immediately to the right of COUNTRY and REGION is an equal sign (=). 9. Figure 10-19 Drilling down on Product Type Chapter 10. Instead of selecting COUNTRY equal to United States. we can select all countries except the United States by changing the button to not equal.fm 5.

Click the Date Dimension tab.7214ch09OLAP. 272 Getting Started with DB2 Web Query for i .Drill down on Amplifiers/PreAmps/Tuner to see the products that compose the Amplifier category.Drill down within the report. Again notice that the drop-down lists have been filled in for you. 2010 1:16 pm 10.fm Draft Document for Review January 3. DB2 Web Query also filled in the Selection pane tabs for you (Figure 10-20). Figure 10-20 Drill down on Product Category 11. not by using the hierarchy tabs. Click Audio. drill down to see only the Amplifier sales that occurred in January 2007. Notice that not only did you drill down from Product Type to the next level of Product Categories within Audio. Figure 10-21 Results of Product Category drill down 12. See Figure 10-21. You can go back and forth this way between the body of the report and the tabs at the top.Continuing to analyze our data.

Try drilling down on a measure or total field. Online analytical processing 273 . Drill down on the Revenue column for Office products (Figure 10-24).Draft Document for Review January 3. Figure 10-23 shows the results of running this report.fm 13. select 2007. 16. 2010 1:16 pm 7214ch09OLAP.Click Run. Figure 10-22 Selecting values in non-consecutive levels 14.For Year. Figure 10-24 Drilling down on a measure Chapter 10.Click Reset to start back at the beginning with an unfiltered report. You can then select the quarter or go straight to month and select 01 (Figure 10-22). Figure 10-23 Slice of your data (January 2007) 15.

that is across the top. the Office product type is expanded to its subcategories and products.The next request from our users is to generate a report that shows revenue by product type by year.Reset your report now so that all drill downs are removed.7214ch09OLAP. The Revenue and Order count are now grouped at a much more detailed level (Figure 10-25). 18. Drag ORDERDATE_YEAR from the Selections pane into the area of the report where you want it. Figure 10-25 Results of drilling down on a measure 17. 2010 1:16 pm After drilling on the revenue for Office products. The plus symbol (+) shows that you are in a valid area to drop the field (Figure 10-26).fm Draft Document for Review January 3. Figure 10-26 Dragging and dropping dimensions 274 Getting Started with DB2 Web Query for i .

Draft Document for Review January 3.Click the Save button and select Save Report to save the new pivot report (Figure 10-29).We now have a pivot table. If you decide that you prefer to see the years down the left column. Figure 10-27 Hiding a field 20.fm 19. Figure 10-29 Saving an OLAP report Chapter 10. the + sign directs you to where you can validly drag the field. 2010 1:16 pm 7214ch09OLAP. Online analytical processing 275 . drag the column name ORDERDATE_YEAR to the left of Product Type (Figure 10-28). You can also see what happens when you save to the Excel and PDF output formats. Again. Figure 10-28 Pivot report 21.Right-click Order Count and select Hide (Figure 10-27).

276 Getting Started with DB2 Web Query for i . 2010 1:16 pm 22. Figure 10-30 Saving a report to your folder 23. If you want to save this report without any OLAP capabilities. Click OK. there are other methods to display additional columns in the report as explained in the following steps. we do not select this option.fm Draft Document for Review January 3. select the Save without OLAP option.Our users have changed their minds and decided that they do not want a pivot table. Since you used the OLAP functionality to design a new report for a user.7214ch09OLAP. Drag ORDERDATE_YEAR from the Sort across portion of the report to the Sort by section (Figure 10-31). Instead they want to see the year and product type to the left of Revenue. Figure 10-31 Pivoting a column In addition to dragging from the Selection pane area.In the window that opens (Figure 10-30). specify the folder for your report.

You see a list of all the measures that are available to you in this report.fm 24. Figure 10-33 Measures tab Chapter 10.Draft Document for Review January 3. display Order Count. Notice that you see that only numeric fields are available. These are the columns that are available for display. Online analytical processing 277 . We visualize Revenue. b. You see a list of columns that were either part of the initial report or are in one of the hierarchies. Notice that Order Count has no check mark. 2010 1:16 pm 7214ch09OLAP. Right-click Revenue and select Unhide. and hiding the measure.Right-click ORDERDATE_YEAR and select Unhide (Figure 10-32). visualizing. and run the report again. Notice that you can cycle through the different options for displaying.Click the down arrow for the Measures tab (Figure 10-33): a. To display Order Count. Select Revenue. select it again. This is because we hid it. 26.Try the same process for the Revenue field. Figure 10-32 Unhiding columns 25.

Click Run. 2010 1:16 pm 27. Click the icon to the right of Revenue to cycle through the graph types until you come to pie charts. d. b. Select Revenue. c.Click the down arrow for the Graph tab (Figure 10-34): a.7214ch09OLAP. Make the pie chart window larger by dragging down the horizontal break line between the graph and the report.fm Draft Document for Review January 3. Break line Figure 10-34 Graphing an OLAP report 278 Getting Started with DB2 Web Query for i .

You can select each measure for graphing and choose a different graph type. For example. you can graph them on the same chart. several functions can be performed only from the OLAP Chapter 10. or both. click Reset to restore the report to its original values. Although the most frequently used functions are available directly from an OLAP report. 2010 1:16 pm 7214ch09OLAP. Tip: If our report has multiple measures that can be graphed. Now we use the third method for interacting with the data. click OK to return to the view shown in Figure 10-36.Experiment with the various options for drilling down and filtering your report. which is the OLAP Control Panel. use the drop-down lists in the Selection pane. if you only want a graph for 2007 revenue. Online analytical processing 279 .fm Notice that there is one pie chart for each year that was your major sort by axis. For example. you can superimpose a line graph on a bar graph with the line representing the profit and the bar representing revenue.Draft Document for Review January 3.4. you can select the year 2007 from the ORDERDATE_YEAR drop-down list.2 Manipulating the data using the OLAP Control Panel Up to this point. if our report contains profit. the Selections pane. 10. See Figure 10-35. 28. then the graph can be drilled into. Tip: If your OLAP Control Panel shows the selection criteria pane. Figure 10-35 Graph drill down Drilling down on the graph generates the same report as though you drilled down on the Revenue field in the original report. you can click the blue square next to Product Type. 1. we have manipulated the OLAP report through the Selection pane at the top of the report and directly through hyperlinks in the report itself. When you are finished. Alternatively. Tip: To control the scope of the graph. Click the OLAP button at the bottom of the Selections pane to open the OLAP Control Panel. If the measures in the original report were drill down capable.

7214ch09OLAP. We want to see our data in columns by quarter: a. quartile. It should appear in the Drill Across box.fm Draft Document for Review January 3. c. The OLAP Control Panel can do everything that can be done from the OLAP report and the Selections pane and more. When selected. it is surrounded by a blue rectangle. b. The following unique OLAP functions. Tip: If Quarter appears in the Drill Down box by accident. can only be performed from the OLAP Control Panel: – – – – Selection of a Top or Bottom n rows report Ability to group numeric data by percentile (or decile. Click Run. d. among others. Click the ORDERDATE_QUARTER field. Click the Drill Across box. See Figure 10-37. 280 Getting Started with DB2 Web Query for i . 2010 1:16 pm Control Panel. simply highlight it and use the Pivot button to pivot Quarter from rows to columns. and so on) Advanced row selection criteria Stacking of multiple measures vertically in a report as opposed to horizontally Figure 10-36 OLAP Control Panel 2. Expand Date Dimension.

2010 1:16 pm 7214ch09OLAP. Double-click Quarter Q1 to drill down to month (Figure 10-38). Figure 10-38 Cross-tab drill down Chapter 10. Online analytical processing 281 .fm Figure 10-37 Specifying data in columns by quarter e.Draft Document for Review January 3.

This is not appropriate for our data that contains only records from 2006 and 2007. that is June. From the OLAP Control Panel. we now have the sales for every Q1 added up together (Figure 10-40). but it is interesting to see the capability. If the Orders table contains data for multiple years. Open the OLAP Control Panel and select Stack Measures (Figure 10-39). Note: For most dimensions. In the window that opens (lower half of Figure 10-41). Figure 10-39 Stack Measures option There is a potential problem with this report as it stands right now. you see the list of values from your table. select 2007 and click Add.7214ch09OLAP. Deselect Range. you see that the actual month names. the report can become wide and unwieldy. For Year. 282 Getting Started with DB2 Web Query for i . Often when you have multiple measures and sort across columns. are filled in for ease of use for the user. The date components are prefilled in with general dates. 5. Although this is technically accurate. expand Date Dimension and select Values for ORDERDATE_YEAR (Figure 10-41). 2010 1:16 pm 3. select the Range box. If you expand ORDERDATE_MONTH. it probably is not what the user wants to see. Figure 10-40 Stacked measures report 4. when you click Values.fm Draft Document for Review January 3. Click Run.

Click Run. In the Selection Criteria pane (Figure 10-42). you can modify the operand for each filtered column. you can click Run. In both cases. You can click the down arrow next to Product Type or you can click the Select button. click OK to see the full Selection Criteria pane.fm Figure 10-41 Filtering an OLAP report 6. At this point. when filtering. Using the Select button takes you to a second window. for demonstration purposes. you see all the various dimensions and their individual elements or columns that were available through the tabs in the Selection pane. 2010 1:16 pm 7214ch09OLAP. Here. you have two choices. If you want to filter on Product Type. notice that Q1 is prefilled in for ORDERDATE QUARTER. Chapter 10.Draft Document for Review January 3. 7. If you use the scroll bar on the right. because we drilled down and selected Q1 prior to opening the control panel. you see a list of all the unique values for Product Type. You can continue to filter your data here. However. Again. This is easier to use when you are selecting multiple values. Online analytical processing 283 . we do not filter on Product Type.

Note: Best practice states that you should always display any filters in effect on a report. 2010 1:16 pm Figure 10-42 OLAP filtering Figure 10-43 shows the output of running the report. DB2 Web Query has the capability from the OLAP Control Panel to document your filters at the beginning or end of your report. Figure 10-43 2007 only report 284 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3.7214ch09OLAP.

Then click the Revenue name. Figure 10-44 Measures pane 10. 2. b.Draft Document for Review January 3. you can ask to see each Revenue as a percentage of the product type revenue in that quarter (Row Percent). Chapter 10..fm 8. In the Measures pane (Figure 10-44). 3 . you sort from low to high and then rank and select your top three. For Highest. e. select the Revenue check box.In the Revenue pane (Figure 10-45 on page 286). you can ask to see the Revenue column in multiple ways. Select the Rank (1. keep the default of None. c. 2010 1:16 pm 7214ch09OLAP. 9. select 3. click OK to return to the initial layout. Notice that you can click Selection Criteria in the bottom right of the Control Panel to return directly to the Selection Criteria layout. For Measure Calculations.) check box.. Online analytical processing 285 . For example. You can ask to see the average revenue per order and much more. If you are still on the Selection pane in the OLAP Control Panel. Select the Sort check box. d. if we want to see a Top 3 analysis report: a. Tip: If you want to see a report that shows your bottom Products by revenue. Notice that if you expand Measure Calculations. Select High to Low.

Figure 10-46 Starting report showing sales people and their attainment 286 Getting Started with DB2 Web Query for i . but you should be aware that this capability exists. For example. and so on). quartiles. From the OLAP Control Panel (Figure 10-46).7214ch09OLAP. deciles. If the twentieth and twenty-first sales people are tied. The example described in this section starts with a report that has one record for each sales person showing their revenue attainment. The company wants to reward the top 10% of their sales people. the twenty-first sales person moves into the top ten percent as well.4.3 Grouping data into percentiles The reports and data used in these tutorials do not lend themselves to grouping into tiles (percentiles.fm Draft Document for Review January 3. it wants to know who the top 20 people are. we highlight the revenue field LineTotal1 and click the Sort button. if the company has 200 sales people. 2010 1:16 pm Figure 10-45 Top 3 OLAP report 10.

We want the new column with the group number to be called Decile. we can ask the system to split the sales people into 20 groups and then we choose the top group. If we want to see the top 5% of the sales people.fm In the next pane (left in Figure 10-47). we choose a high to low sort sequence and then select the Tiles tab. To get the top 5%. we choose groups 1 . we restrict the report to the first tile only. 2010 1:16 pm 7214ch09OLAP. On the Tiles tab (right in Figure 10-47). we select the options to tile the report in groups of 10 so that we can see our revenue numbers evenly split into ten groups.5. Online analytical processing 287 . If we only want to see the top 10%. We can also split the sales people into 100 groups with 1% in each group.Draft Document for Review January 3. Figure 10-47 Sorting LineTotal1 into groups of 10 Chapter 10.

fm Draft Document for Review January 3. 2010 1:16 pm 288 Getting Started with DB2 Web Query for i .7214ch09OLAP.

Power Painter is architected for PDF output and has additional controls specific to large PDF reports. You can create compound reports with background style sheets and add company logos and other standard HTML components. It cannot create a PDF report.Draft Document for Review January 3. highly parameterized active report. and so on. “Developer Workbench” on page 249. you must have completed Chapter 9. we design two different HTML pages. but rather references existing ones. product type. HTML Composer HTML Composer is a component of IBM Developer Workbench.fm 11 Chapter 11. this report is typically developed by IT but. in this case. You have already tried Power Painter. Here we take an existing active report and initiate it from an HTML page that contains a large number of input parameters in a user friendly manner. It can also create other types of output such as HTML pages. 2010 1:15 pm 7214chHTML. © Copyright IBM Corp. “Active Reports” on page 229) and understand those concepts. is often deployed to business analysts or disconnected users who want to highly segment the data they are analyzing. All rights reserved. Again. Choose the option that fits your company’s needs the best. 289 . The design of the HTML page can be set to match your company’s intranet standards. In this tutorial. as the name suggests. HTML Composer is architected for HTML pages. HTML Composer is specifically designed. The first is a compound report with a single input parameter. HTML Composer does not create reports or graphs. This style of report can be used as the basis for key performance indicator (KPI) dashboards where the user might request the KPIs for a specific country. you try HTML Composer. it can only create HTML pages. Both HTML Composer and Power Painter can create compound reports. to design HTML pages. This tutorial assumes that you have completed the Active Reports tutorial (Chapter 8. 2009. The products both have different user interfaces. In this tutorial. The second report that we design is a single. Prior to starting this set of tutorials. This type of report is often designed by IT and deployed to senior management and executives within a company.

It is also used to refer to the completed HTML page.fm Draft Document for Review January 3. 290 Getting Started with DB2 Web Query for i . we must add product type as a parameter to the three reports that we want on our KPI page. You can run Report Assistant and Graph Assistant from either Developer Workbench or the DB2 Web Query home page. In Chapter 9. Figure 11-1 shows the final output page. Figure 11-1 Compound report 11. using two graphs and one report created in previous exercises. 2010 1:15 pm 11. we introduce the two main functional areas of Developer Workbench. In the first exercise. Generic term report: The generic term report is used for both text reports and graphs. we add a common parameter and bring them together on one HTML page for the user.1 Compound parameterized report (HTML1_KPI) In the first exercise. In this section. we do all our work from Developer Workbench. The second branch expands down through Managed Reporting to allow you to work with the folder in your domains. We modify the existing reports to accept this parameter and then save them under new names. “Developer Workbench” on page 249.1 Adding parameters to existing reports In this tutorial. the completed HTML page is a compound report. The first leg of the explorer tree expands through Data Servers to allow you to work with your metadata.1.7214chHTML.

2010 1:15 pm 7214chHTML. This is an optional setting described in Chapter 9. Tip: Even though you rename the report in the window to HTML1_KPI_LINE. You may or may not see Windows Desktop. right-click and select Paste. Chapter 11. In your Tutorials folder. You see WebFOCUS Environments under Developer Studio Desktop. Restriction: When accessed by Developer Studio. You now have a report titled GA3_Trend1 in the Tutorials folder. As a workaround. if you look in the integrated file system or look at the properties of the new report. 5.fex. 3. you see that the object name is still ga3_trend1. 2. Report Assistant does not currently support the Save As capability. HTML Composer 291 .fm 1.Draft Document for Review January 3. Expand WebFOCUS Environments → your environment → Managed Reporting → Domains → Common Domain → Reports → Tutorials. Figure 11-2 Developer Workbench reports 4. and select Copy (Figure 11-2). “Developer Workbench” on page 249. Open Developer Workbench. we use Copy and Paste to place the report into the same directory. Give the report the name HTML1_KPI_LINE. not the physical name on disk. Keeping your cursor in the same pane (the list of your reports). You have changed only the display title of the report. right-click. This is a known requirement. navigate to the graph GA3_Trend. Right-click your new report GA3_Trend1 and select Rename.

Click Select values. d. Accept all the defaults for PRODUCTTYPE prompting. Click OK. In Graph Assistant. Graph Assistant opens. c. click OK. DB2 Web Query knows which tool was used to create your report. b. Power Painter is not directly supported in Developer Workbench. Delete all existing selection criteria.fm Draft Document for Review January 3. 8. Figure 11-3 Selecting the Edit in Developer Studio Tool option 7. choose the Selection criteria tab. Selecting the default option opens the report in either Report Assistant or Graph Assistant. select Parameter and then click the Auto Prompt button. whichever is appropriate. Drag PRODUCTTYPE to the Selection pane. 9. 2010 1:15 pm 6. 292 Getting Started with DB2 Web Query for i . Right-click HTML1_KPI_LINE and select Edit in Developer Studio Tool (Figure 11-3). On the Selection criteria tab (Figure 11-4): a.7214chHTML. In the EQ Values window. e. Back on the EQ Values window. In this example.

2010 1:15 pm 7214chHTML.Draft Document for Review January 3. clear the Show axis labels check box. a.fm Figure 11-4 Selection criteria and parameter prompting Notice in the Selection pane (Figure 11-5) that the Select values link has changed. Chapter 11. Click the Properties tab and the X axis subtab (Figure 11-6).Remove the months from the X axis labels to free more room in the small output frame for the graph itself. b. Figure 11-5 Completed selection criteria 10. On the X axis subtab. HTML Composer 293 .

7214chHTML.fm Draft Document for Review January 3. 2010 1:15 pm Figure 11-6 Removing the X axis labels 294 Getting Started with DB2 Web Query for i .

Click the Options subtab (Figure 11-7). 2010 1:15 pm 7214chHTML. From experience. we know that the frame for our graph is about 350 pixels wide by 250 pixels high. You might need to design your HTML page. HTML Composer 295 . Set the output size to 350 pixels wide (Horizontal) by 250 pixels high (Vertical). d. see how much room you have for your graph. This can be an iterative process. and then return to the output options for the graph to ensure that it will fit in the designated space. Figure 11-7 Properties tab Chapter 11.fm c. e. Save your graph.Draft Document for Review January 3.

f. 2010 1:15 pm 11.fm Draft Document for Review January 3. Your report should have only one parameter. Figure 11-8 X axis field label deleted 11. Open Developer Workbench. If you need more detailed assistance.We repeat the previous steps for the existing bar chart GA1_Bar. b. we explain how to design the layout for an HTML report: 1. Click the Field selection tab (Figure 11-8). c. refer to the previous steps and figures. Click Show . Copy and paste the GA1_Bar and rename it HTML1_KPI_Bar.2 Designing the layout for the HTML report In this section. Set the output size to 350 pixels wide by 250 pixels high. accepting the auto prompting defaults. for the X axis field label field.1. 296 Getting Started with DB2 Web Query for i . To save space for our graph. e. delete Country.Field options. Save your graph. 2. d. Expand WebFOCUS Environments → your environment → Managed Reporting → Domains → Common Domain → Reports → Tutorials.7214chHTML. a. Add a PRODUCTTYPE parameter.

and the SQL Wizard to create your new report. Tip: To create a text report or graph. Chapter 11. Right-click the Tutorials folder and select New → HTML File (Figure 11-9). Figure 11-9 New HTML file 4. Graph Assistant.fm 3.Draft Document for Review January 3. HTML Composer 297 . 2010 1:15 pm 7214chHTML. Call your new report HTML1_KPI and click Create. You then see a window that allows you to choose between using Report Assistant. select New → Procedure.

The sections that follow refer to this figure unless noted otherwise.7214chHTML. Draw a box similar to the box in the upper left corner labeled “1” in Figure 11-10. 1 2 3 Figure 11-10 Design layout for HTML report Including a line chart To include a line chart in the HTML report: 5. Figure 11-10 shows the final layout design of our compound report. a bar graph. and the gross profit report. Look at the properties box in the right pane.fm Draft Document for Review January 3. This is the size we designed our graph for. 298 Getting Started with DB2 Web Query for i . Click the graph icon from the toolbar (circled in Figure 11-11). we explain how to include a line chart. Figure 11-11 HTML Layout toolbar 6. 2010 1:15 pm In the next subsections. Your box should be 250 pixels high and 350 pixels wide.

but it also references any parameters that are used by the graph. Right-click box 1 and select Reference existing procedure (Figure 11-12).fm 7. 2010 1:15 pm 7214chHTML. Figure 11-12 Reference existing procedure 8. Notice that the actual file name is displayed (Figure 11-13). Open your HTML1_KPI_Line file in the Tutorials folder. HTML Composer 299 . This not only shows how the graph will look in this frame. Figure 11-13 Procedure being referenced Chapter 11.Draft Document for Review January 3.

the system creates a panel that contains your parameter label. b. 300 Getting Started with DB2 Web Query for i . Figure 11-14 Defining a parameter 10. Click OK.fm Draft Document for Review January 3.7214chHTML. the system presents a list of the parameters used in HTML1_KPI_Line. like the following example. 2010 1:15 pm 9. We said no to this because we want to be able to move each of these elements separately on our page. select Do not create a form. accept the default of Drop-down list. the drop-down box. In the New Parameters window (Figure 11-14).Delete the label PRODUCTTYPE. For Control Type. c.Move the drop-down list and the Run button as shown in Figure 11-10 on page 298. a. For Parameter grouping options. Your Run button looks slightly different at this stage. 11. New form element: If you accept the default New form element. a run button and a refresh button. We reference Product Type in our overall report heading.

Figure 11-15 Setting the name property Chapter 11.Select the line graph. 2010 1:15 pm 7214chHTML. change Name to LineGraph (Figure 11-15). HTML Composer 301 .fm 12.Draft Document for Review January 3. In the Properties pane on the right.

Draw a box similar to the box in the upper right corner in Figure 11-10 on page 298 labeled “2”.7214chHTML.fm Draft Document for Review January 3. Click the Parameters tab in the lower right corner. 2010 1:15 pm 13.Select HTML1_KPI_Bar.To make the two graph frames the same size. 15.Click the graph icon. Select the Add “ALL” option and specify to display All Products. 19. 16. Figure 11-16 Adding the ALL option to a parameter Including a bar chart To include a bar chart in the HTML report: 14. 17. you can use the Properties pane and manually size the frames to both be 250 x 350. 18.Right-click the new graph frame and select Reference existing procedure.Select the Properties tab at the bottom of the right pane. Notice that it is the last element selected that controls the final size of all the selected elements.Click the drop-down control box in the report (circled in Figure 11-16). 302 Getting Started with DB2 Web Query for i . We use the alternative to select both frame 2 and frame 1 using the Ctrl key and click the Make same size icon ( ).

29. Select the text icon (Figure 11-18). 27.In the Properties pane on the right. Enter the text Product Type Indicators.From the Properties pane on the right. set Auto Execute to True. Change the Name to GrossPftReport. 30.Draw a box similar to the box in the upper right corner in Figure 11-10 on page 298 labeled “3”. 28. c. HTML page options To make this page look a little cleaner. set Frame border to No.Select the report icon (Figure 11-17). set Size and Scrolling to No.To have the all three reports in our compound HTML page automatically run when the page is opened. This automatically adjusts the size of your frame so that your report fits in it and you do not have to scroll within the frame. Figure 11-17 HTML Composer toolbar 23. 2010 1:15 pm 7214chHTML. Draw a box in the pane where you want the report title to be. change the name to BarGraph.Highlight each of the three reports.Right-click the frame and point to the RA4_Advanced report.Again select frame 2 and then frame 1 and click the Align top icon ( 21. we remove the frames around each of the reports: 26.In the Properties pane on the right.Click your text box so that it is surrounded by a straight line frame and not slashes. a.fm 20.Give the report a title. HTML Composer 303 . ). Including the gross profit report (RA4_Advanced) To include the gross profit report: 22. Chapter 11. Figure 11-18 Adding text to an HTML page b. 24.Draft Document for Review January 3. highlight each of the three reports and from the Properties pane on the right. 25.

34.In the Properties pane on the right. bold.Save your report and then run it by clicking the Run button (circled in Figure 11-20). For Source. Your Hyperlink Properties window should look like the example shown in Figure 11-19. Executing the Run button Finally. 32. select BarGraph to indicate which frame the report should run in. We need to tell it to also execute our other two reports when the user clicks Run. button. click the . To add the second graph. a. Figure 11-20 Run button 304 Getting Started with DB2 Web Query for i . click the ellipsis button (.Define the styling for your heading by selecting the following options: arial.The Run button is initially set to execute the original report that was used to import the parameter. 36. we tell the system which reports need to execute when the Run button is clicked: 33. for Action.) next to Styling: Font. underlined.. Figure 11-19 Hyperlink properties 37.7214chHTML. and navigate to and select HTML1_KPI_Bar.In the Hyperlink Properties window.. d.fm Draft Document for Review January 3. 18pt.Right-click the Run button and choose Hyperlink properties. b.. For Target Name. 2010 1:15 pm 31.. change the display text to RUN and appropriately size the RUN button. select External procedure. Repeat the process and select the external procedure RA4_Advanced and point it to the frame GrossPftReport. 35. and blue. c.Click the add icon ( ) on the right.

2 Highly parameterized report (HTML2_Parm) In this exercise. The easiest method is for a developer to stay within Developer Workbench and test from there. using an active report that we created previously. HTML Composer 305 . Although we base this tutorial on an active report.fm Tip: You can return to the DB2 Web Query home page and run this dashboard. which is shown in Figure 11-22 on page 306. Your dashboard or KPI should look like the example in Figure 11-21. we add multiple parameters to it. This exercise uses the Active Report AR1_GrossPft. Figure 11-21 Completed compound report 11. 2010 1:15 pm 7214chHTML. we can invoke any report or graph. You might want to quickly run this report and make sure that it looks like the example in the figure. Chapter 11.Draft Document for Review January 3. Do not forget that the page should be designed small enough to be viewed within the context of the DB2 Web Query home page. This highly parameterized technique is effective for subsetting the data that a user wants to download to Excel. This allows a user to segment the data that they want to analyze in different ways.

2010 1:15 pm Tip: If your active report is in the accordion format. You now have a report titled AR1_GrossPft in the Tutorials folder. 4. and select Copy. 2.fm Draft Document for Review January 3. Expand WebFOCUS Environments → your environment → Managed Reporting → Domains → Common Domain → Reports → Tutorials. 5. Keeping your cursor in the same pane (the list of your reports).7214chHTML. right-click and select Paste. Save your report. right-click. Right-click AR1_GrossPft and select Rename. Give the report the name HTML2_Parm_AR. In your Tutorials folder. Figure 11-22 AR1_GrossPft Active report To create the report: 1. 3. Open Developer Workbench. choose Active Report Styling and select Tabular for Report view. open the report. 306 Getting Started with DB2 Web Query for i . go to Report options. navigate to the AR1_GrossPft report.

select the Autoprompt wizard. Click the Selection criteria tab and enter.Draft Document for Review January 3. click Select values. The table shows the field name to drag to the Selection criteria pane and the condition to use. all the conditions are WHERE conditions. but ORDERDATE. In all fields. HTML Composer 307 . Figure 11-23 Opening the report in Developer Workbench 7. In the Autoprompt pane. the parameters shown in Table 11-1. 2010 1:15 pm 7214chHTML. Open the new report. Then click OK. Table 11-1 Parameters for WHERE conditions Field name WHERE PRODUCTTYPE Condition EQUAL to Select values Select parameter Autoprompt Select multiple values Select parameter Autoprompt Select multiple values Select parameter Autoprompt Select multiple values Select parameter Autoprompt Select multiple values Select parameter Autoprompt Select multiple values Select parameter Autoprompt Select multiple values Select parameter Autoprompt Select multiple values Select parameter Enter field name From_Date under Parameter (do not autoprompt) See Figure 11-24 WHERE PRODUCTCATEGORY EQUAL to WHERE SALESREP EQUAL to WHERE COUNTRY EQUAL to WHERE REGION EQUAL to WHERE STATE EQUAL to WHERE PLANTNAME EQUAL to WHERE ORDERDATE GREATER THAN or EQUAL to Chapter 11. Based on this table. choose Select multiple values. For all parameters. In the right pane.fm 6. right-click HTML2_Parm_AR and select Edit in Developer Studio Tool (Figure 11-23). in sequence.

308 Getting Started with DB2 Web Query for i . 11.1 Creating the report in HTML Composer To create the report in HTML Composer: 10. Figure 11-25 Selection criteria parameters 9.Navigate to the Tutorials folder in Developer Workbench. Save and close the report.fm Draft Document for Review January 3.2. Right-click Tutorials and select New → HTML File (Figure 11-26). instead of using the Autoprompt wizard. Figure 11-24 Date parameter The finished Selection criteria pane should look like the example in Figure 11-25.7214chHTML. For the date fields. We use From_Date for the first date parameter and To_Date for the second date parameter. 2010 1:15 pm Field name WHERE ORDERDATE Condition LESS THAN or EQUAL to Select values Select parameter Enter field name To_Date under Parameter (do not autoprompt) 8. enter a parameter name that you want to use (Figure 11-24).

In the window that opens (Figure 11-27). saving us from adding them manually.In this example.Draft Document for Review January 3. 2010 1:15 pm 7214chHTML. a new window opens that contains the active report. enter a report name of HTML2_Parm and click Create. We remove the report frame itself after we import all the parameters. Figure 11-27 New report name 12. Click the report icon (circled in Figure 11-28) and draw a small box in the upper left corner of the pane.fm Figure 11-26 Creating a new HTML file 11. Chapter 11. We must import the report onto the HTML page so that DB2 Web Query automatically brings in all the parameters that are defined in the report. When the Run button is clicked. we create an HTML page that contains the various parameters and a Run button. HTML Composer 309 .

For PLANTNAME.Select the HTML2_Parm_AR report that you just created.You are presented with a list of parameters that are referenced by this report (Figure 11-30). 15. b. c. a. change the control type to Calendar. Under Parameter grouping options. e. Figure 11-29 Link to existing procedure 14. For both dates. change the control type to Radio button. For COUNTRY. 310 Getting Started with DB2 Web Query for i . 2010 1:15 pm Figure 11-28 Importing a report 13.Right-click the report (the box that you just drew) and select Reference existing procedure (Figure 11-29). select Do not create a form. For SALESREP.7214chHTML. change the control type to Double list control. d.fm Draft Document for Review January 3. change the control type to Check box.

Draft Document for Review January 3. Figure 11-31 Imported parameters Chapter 11. 2010 1:15 pm 7214chHTML. HTML Composer 311 .fm Figure 11-30 Selecting the parameter control types The system lays out all the chosen parameters in a column on the HTML page similar to the layout in Figure 11-31.

7214chHTML.fm

Draft Document for Review January 3, 2010 1:15 pm

16.Making sure that you keep the headings and controls together, drag the parameters into a layout similar to Figure 11-32. You must scroll to see the entire page of parameters. See the following steps to size the Country control box. – Make sure that you leave enough room at the top of the report for a report heading. – Some of the boxes, such as SALESREP, require resizing. Keep any frames that are within a panel, in the panel when they are moved or resized.

Figure 11-32 Rough layout for parameters

Note: This exercise is designed to introduce you to many of the controls and capabilities of HTML Composer. Is it not intended to teach window design. Do not design a window that has this many different controls and looks like this in production applications. 17.We want to change Country from one column wide to two columns wide (Figure 11-33): a. Highlight the Country control box. b. From the Properties pane, select columns and type 2. 312
Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:15 pm

7214chHTML.fm

c. Size the control box appropriately.

Figure 11-33 Two-column radio control box

Parameter controls
In this section, we illustrate how to define the sequence in which the cursor moves from cursor to cursor also known as parameter controls: 18.Highlight the Producttype control box. 19.In the Properties pane on the right, select Tab index and enter 1. Tab index controls the sequence in which the cursor moves from field to field.

Chapter 11. HTML Composer

313

7214chHTML.fm

Draft Document for Review January 3, 2010 1:15 pm

20.Click the Parameters tab at the bottom of the right pane. This is where you can override options such as your type of control box or the text to go with the ALL option. Select the add ALL option for every parameter except the dates. 21.Highlight the Productcategory control box. 22.Click the Properties tab (Figure 11-34), and under Tab index, enter the value 2.

Figure 11-34 Properties tab

314

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:15 pm

7214chHTML.fm

Chaining the controls together
We want to set up our parameters so that the value selected for product type modifies (filters) the values that are displayed in the product category drop-down list: 23.Click the producttype control box. Holding down the Shift key, also select Productcategory. 24.Click the Add chain button (circled in Figure 11-35). This function chains the parameters together in the sequence in which you selected them. Tip: If you right-click a control box that is chained to another control, you can override the chaining logic. The default in our example shows all product categories that have a product type equal to what the user selected. You can choose any relationship to the controlling parameter, that is less than, greater than, and so on. In our example, EQUAL is really the only choice that makes sense and it is always the default.

Figure 11-35 Chaining parameters

25.Highlight the Salesrep control. In the Properties pane, for Tab index, type 3. 26.Highlight the Country control. In the Properties pane, for Tab index, type 4. 27.Highlight the Region control. In the Properties pane, for Tab index, type 5. 28.Highlight the State control. In the Properties pane, for Tab index, type 6. 29.We want the Country parameter to control or filter the Region parameter, and we want the Region parameter to filter the State list box. To chain Country to Region to State: a. Select the Country control box. b. Hold down the Shift key, and select the Region control box. Still holding down the Shift key, select the State control box. c. Click the Add chain button shown in Figure 11-35. 30.Highlight the Plantname control. In the Properties pane, for Tab index, type 7.

Chapter 11. HTML Composer

315

7214chHTML.fm

Draft Document for Review January 3, 2010 1:15 pm

Using calendar controls
In this section, we illustrate how to define the controls when dealing with Date fields: 31.Right-click the calendar icon under From_Date and select Calendar Properties. 32.For Date range, select Static. Specify a range from January 1 2006 to December 31 2007. For Date format in data source, select YYMD. Click OK. See Figure 11-36. 33.Highlight the From_Date control. 34.In the Properties pane, for Tab index, type 8. 35.Repeat these calendar control steps for To_Date using a Tab index of 9. Tip: The more common calendar option is probably relative dates, for example within the last two years. Since our data only contains dates in 2006 and 2007, we chose the static dates for this example.

Figure 11-36 Calendar controls

36.Right-click the Run report1 control box and select Hyperlink Properties.

316

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:15 pm

7214chHTML.fm

37.In the Hyperlink Properties window (Figure 11-37), complete these steps: a. Change Display Text to RUN. b. Change Target Type to Window. This runs the report in a new window instead of in the frame drawn on the current HTML page.

Figure 11-37 Hyperlink properties RUN

38.Delete the original frame you drew when importing the report. It is located below all the parameters. 39.Select the RUN control box. In the Properties pane, for Tab index, type 10. 40.Resize the Run button by dragging the frame. 41.Add a heading to the report: a. Click the text icon on the toolbar and draw a box to contain your heading (Figure 11-38). Note: In addition to text and reports, you can import images to your page using the icon to the left of the text icon. You can use define cascading style sheets to tailor the look of your page.

Figure 11-38 Adding text to a page

42.Enter a title of Gross Profit Active Report. 43.Click your text box so that it is surrounded by a straight line frame and not slashes. 44.In the Properties pane on the right, select the ... button next to Styling: Font.

Chapter 11. HTML Composer

317

7214chHTML.fm

Draft Document for Review January 3, 2010 1:15 pm

45.In the Font window (Figure 11-39), select the styling for your heading: a. b. c. d. e. For Font, select Arial. For Font Style, select Bold. For Size, select 18pt. For Effects, select Underline. Click OK.

Figure 11-39 Styling text

46.Click the background area of the HTML layout. 47.In the Properties pane, click the ... button next to Background color and select a pale color (Figure 11-40).

318

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:15 pm

7214chHTML.fm

Figure 11-40 Background color

48.When we modified all the parameter control boxes, we changed the tab index in the Properties pane. This controls the sequence that the users tab through the fields in the window. We still have a problem in that some of the other elements on the page have a tab index that might conflict with our sequence numbers. Starting with the title, highlight the frame, and find the tab index number. If it is less than or equal to 10, change it to an arbitrary number above 20. The Run button had a tab index of 10 and we want it to be last in our normal sequence. Do not forget to check the arrow elements in Salesrep. Tip: If you hover over the icon second from the left that looks like a hand and multiple small boxes, you should see the text “Tab Order”. Selecting this shows the sequence of your tabs for the user. Make sure that you do not have duplicates and the order is left to right, top to bottom for INPUT capable fields. 49.Save and run the report.

Chapter 11. HTML Composer

319

7214chHTML.fm

Draft Document for Review January 3, 2010 1:15 pm

50.For our first test, select ALL for Salesrep and 2006/01/01 to 2006/12/31 for the dates (Figure 11-41). Tip: Having chosen the double list control for Salesrep means that you always have to select at least one item for SALESREP. This can be ALL, but there must be a value in the output list.

Figure 11-41 Prompting for parameters

320

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:15 pm

7214chHTML.fm

51.Click RUN. Figure 11-42 shows the output of running this report.

Figure 11-42 Final output

At this point, you can try and run the report taking advantage of the parameter chaining. Selecting a product type changes the product categories list box. Similarly choosing a region changes the state displayed. Then go back to your parameter design page and start tailoring the page to look like a more practical report that you might show to a user.

Providing multiple report output format options for users
In some cases your users may want to choose the output format dynamically at run time. For example, user OZZIE may want the Gross Profit report to be generated as an Active Report, while user ARCH prefers that same report to be presented as a PDF file, and SHANEG is a power Excel user and likes his reports as spreadsheets. While there currently is not a setting within the development tools to set up this type of feature, it can be accomplished by creating multiple copies of the reports and setting up buttons to call the appropriate report. In this section, you learn how to provide this type of report output flexibility. For each desired output format that you want to provide to your users, the following steps need to be taken: Make a copy of the report Edit that report and change the output format Rename the report to something meaningful (to represent/indicate the output format) Create a new button in the HTML page Change the text of the button so that users know what output format it represents Change the properties of the button to call the appropriate report when pressed The process is explained in detail in the steps below: 1. Open DB2 Web Query in a web browser session, right-mouse click the report HTML2_Parm_AR and select Open as shown in Figure 11-43 on page 322.
Chapter 11. HTML Composer

321

7214chHTML.fm

Draft Document for Review January 3, 2010 1:15 pm

Figure 11-43 Open report

The report opens in Report Assistant development tool. 2. Go to the Report options tab and change the Generate report as setting from AHTMLActive Report to PDF - Portable Document Format as shown in Figure 11-44.

Figure 11-44 Change output format to PDF

3. Create a new copy of the report by clicking Save As and name the report HTML_PARM_PDF as shown in Figure 11-45 on page 323.

322

Getting Started with DB2 Web Query for i

Draft Document for Review January 3, 2010 1:15 pm

7214chHTML.fm

Figure 11-45 Save new report

4. Return to the HTML2_PARM file already open in DB2 Web Query Developer Workbench 5. As shown in Figure 11-46, click the Push button icon to create a new button on the form.

Figure 11-46 Create new button

6. Use the crosshairs to draw the new button on the palette. The new button will be simply labeled “Button”. This is demonstrated in Figure 11-47 on page 324.

Chapter 11. HTML Composer

323

fm Draft Document for Review January 3. change the Display Text to PDF and click on the new Action icon as demonstrated in Figure 11-49 on page 325. To define the action that occurs when user presses it.7214chHTML. 2010 1:15 pm Figure 11-47 Draw new button 7. From the Hyperlink Properties dialog window. Figure 11-48 Figure 11-48 Create hyperlink for button 8. Right-mouse click on the new button and select Create hyperlink as shown in. 324 Getting Started with DB2 Web Query for i .

it should look like the example shown in Figure 11-51 on page 326. Select External procedure as the Action. click on the ellipsis icon under Source.fm Figure 11-49 Hyperlink properties 9. When finished. Chapter 11.Draft Document for Review January 3.Click the Open button to accept this report as the source and return to the Hyperlink Properties dialog. 2010 1:15 pm 7214chHTML. An example is displayed in Figure 11-50. and (from the list of presented procedures) select HTML2_PARM_PDF as the report to run.To display the PDF report in a new browser window. 11. Figure 11-50 More hyperlink properties 10. select Window for the Target Type setting and New Window for the Target/Template Name. HTML Composer 325 .

repeat above steps and substitute the new output format for PDF. Figure 11-52 New PDF report 15.Click OK to accept the changes.Close the window.Click the Save icon to save your changes 14. 2010 1:15 pm Figure 11-51 Completed hyperlink properties 12. 13. 326 Getting Started with DB2 Web Query for i . You should see the report displayed in PDF format as shown in Figure 11-52.7214chHTML.Run the report and click the new PDF button to test. 16.For additional output formats such as Excel spreadsheet.fm Draft Document for Review January 3.

2 Additional parameter tips This section describes additional techniques that can be used to provide more control over how report parameters are displayed and handled. An example is shown in Figure 11-53 Figure 11-53 New report specifications 2. This can be accomplished by utilizing the display field feature of HTML Composer in DB2 Developer Workbench. 2010 1:15 pm 7214chHTML. The sort fields are PRODUCT NAME and PRODUCTNUMBER. The following steps describe how to set up a report and html page that utilizes this feature: 1.2. HTML Composer 327 . Displaying the values of one column while passing another When developing DB2 Web Query reports that require prompt control (input parameters). Using Report Assistant. Chapter 11.Draft Document for Review January 3. you may run into the requirement in which you want to present a drop down list that is based on a column in your database (for example product name). but actually pass a the value of a different column (such as product number) as the input parameter value. the measure is LINETOTAL (include commas and floating currency for formatting). and add PRODUCTNUMBER as a screening condition. An example is provided in Figure 11-54 on page 328. create a new report against CEN_ORDERS. Go to the Selection criteria tab. Define it as a multi-value prompt control parameter that is based on PRODUCTNUMBER in CEN_ORDERS.fm 11.

328 Getting Started with DB2 Web Query for i . Save the report as ra6_parm 4. Run the report with No Selection. 2010 1:15 pm Figure 11-54 Set up prompt control parameter for PRODUCTNUMBER 3.7214chHTML. It should look like the example shown in Figure 11-55 on page 329.fm Draft Document for Review January 3.

Chapter 11.Draft Document for Review January 3. HTML Composer 329 . 2010 1:15 pm 7214chHTML. In the HTML Composer tool select the report icon to add a new report to the layout (Figure 11-57 on page 330). Return to the Developer Workbench tool and create a new HTML file in your Tutorials folder as shown in Figure 11-56.fm Figure 11-55 Example of ra6_parm report 5. Name the new html file html3_parm. Figure 11-56 Create new HTML file for ra6_parm 6.

330 Getting Started with DB2 Web Query for i .Move the elements around on the canvas as shown in the example in Figure 11-59 on page 331. 2010 1:15 pm Figure 11-57 Add report to layout 7. Using the crosshairs. The New Parameters dialog window is presented.7214chHTML. select ra6_parm. 9. select Do not create a form under Parameter grouping options and click OK. Right-click on the report outline and select Reference Existing Procedure. draw/outline the location of the report on the canvas. Figure 11-58 Parameters for ra6_parm report 11.fm Draft Document for Review January 3. 8. 10. From the list of reports displayed.From this window.

Draft Document for Review January 3. 2010 1:15 pm 7214chHTML. HTML Composer 331 .Select the parameter listbox element and on the Properties dialog. select the Parameters tab on the bottom (see Figure 11-60).fm Figure 11-59 Move elements on canvas 12. Figure 11-60 Select parameters tab Chapter 11.

fm Draft Document for Review January 3.7214chHTML. 2010 1:15 pm The properties for the PRODUCTNUMBER parameter are displayed as shown in Figure 11-61. An example is shown in Figure 11-62 on page 333. select/highlight the PRODUCTNAME field and drag it into the area under Display field. Figure 11-61 Parameter properties From the list of field names displayed. 332 Getting Started with DB2 Web Query for i .

HTML Composer 333 .Click the Run icon to test the report Notice that the drop list is populated with Product Names rather than the Product Numbers. Chapter 11. 2010 1:15 pm 7214chHTML.fm Figure 11-62 Make PRODUCTNAME the Display field 13. 14.Draft Document for Review January 3.Select multiple product names in the list (by selecting them and holding down the Ctrl key on your keyboard) and click Run Report1 button. Your results should look similar to the example provided in Figure 11-63 on page 334.

You would also like to filter this list to only show dates for the year 2007. Sort the report by ORDERDATE. This report shows Revenue for the selected OrderDate by Country and Region. save the report 17. To illustrate how this can be set up. and REGION 334 Getting Started with DB2 Web Query for i . Because ProductNumber is the parameter that report is expecting.7214chHTML. This is useful. 2010 1:15 pm Figure 11-63 Example of report that displays one column as parameter but passes another The drop down list on the HTML page is populated with product names. yet the value of the correlating ProductNumber column is passed to the underlying report. for example. The following steps 1.Close the browser window 16. HTML Layout that calls the base report and uses the procedure to populate and sort the drop down list. COUNTRY. Report (procedure) that sorts by OrderDate in descending order and only includes rows for the year 2007.fm Draft Document for Review January 3. This report is generated to XML output format. Launch Report Assistant to create a new report based on the CEN_ORDERS synonym 2. the report is able to find and display the appropriate rows 15.Close the HTML Composer session Using another report to control parameter sorting and filtering Another useful feature that can be implemented in HTML Composer is the ability to use another procedure (another term for a report) to control the parameter list sorting and filtering.Back in the HTML Composer session. but you would like the drop down list sorted in descending order (rather than the default which is ascending). the following three components are created in this exercise: The base report with prompt control of OrderDate. if you have a report with a prompt control parameter of the OrderDate column.

Select ORDERDATE from list of fields These steps are shown in Figure 11-65 on page 336. Chapter 11. Drag ORDERDATE field from list of available fields into the Screening conditions pane. 2010 1:15 pm 7214chHTML. Drag LINETOTAL into the Sum pane and specify column formatting of commas and floating currency. HTML Composer 335 .base report 4. Set up the a prompt control parameter over ORDERDATE column by doing the following a. b.fm 3. Figure 11-64 Using a procedure to sort the parameter list . An example is shown in Figure 11-64.Draft Document for Review January 3. Select Parameter setting and click the AutoPrompt icon d. Click <Select Values> link c.

336 Getting Started with DB2 Web Query for i . 6.7214chHTML.fm Draft Document for Review January 3. Click OK twice. 2010 1:15 pm Figure 11-65 Set up prompt control for ORDERDATE 5. Notice that OrderDates are listed in the drop down list and are sorted in ascending order as shown in Figure 11-66. Run your report. You would also like to filter this list so that only order dates for the year 2007 are presented and can be selected by the user. Figure 11-66 Report with Prompt control for OrderDate The behavior that you really want for this drop down list is to present the OrderDates in descending order. Use the prompt control. Save your report as Revenue for Selected Order Date 7.

The first value is the submission value which is passed to the form control when you click the Submit button.Draft Document for Review January 3. launch Report Assistant to create another report 9. 8. Do this again so that there are two ORDERDATE columns in the Sort by pane. 2010 1:15 pm 7214chHTML. From the Tutorials folder. Figure 11-67 Order by ORDERDATE in descending order Next filter the list so that only entries for 2007 appear. Chapter 11. Important: The procedure must return a name and value pair for each parameter value that will populate the list. These two values can be the same or different.From the list of available fields. Click the <Select Value> link and specify the value 2007 as a Constant. you must create another report (procedure) and use it to handle the parameter sorting and filtering. HTML Composer 337 . Change the Sorting of the first ORDERDATE column to Descending order as shown in Figure 11-67. Select the CEN_ORDERS synonym 10. The second value is the display value which is what you will see in the control. 11.Go to the Selection criteria tab and select the ORDERDATE_YEAR column as a screening condition. specify ORDERDATE as the Sort by field.fm To obtain this behavior. This is demonstrated in Figure 11-68 on page 338. The procedure must return the two data values in XML output format.

Figure 11-69 Change output format to XML 338 Getting Started with DB2 Web Query for i . find and select XML .fm Draft Document for Review January 3. 2010 1:15 pm Figure 11-68 Filter the drop down list for year 2007 The last step is to specify XML as the output format.Select the Report Options tab and select Show unstyled formats from the drop down list at the top. Taking this action will cause the list of report output formats to change.eXtensible Markup Language. From this re-populated list. This is demonstrated in Figure 11-69.7214chHTML. 12.

In the HTML Layout canvas. HTML Composer 339 . Figure 11-71 New Parameters dialog 16. 2010 1:15 pm 7214chHTML.Draft Document for Review January 3.Select the ORDERDATE parameter element displayed on the canvas and select the Parameters tab at the bottom right of the window as shown in Figure 11-72 on page 340. create a new HTML file in the Tutorials folder as shown in Figure 11-70. Chapter 11.Save this report as Parm Sort Procedure The final piece of the puzzle is building the HTML layout. From DB2 Web Query Developer Workbench. This component will use the procedure to sort and filter the drop down list and will reference the base report to execute the query and display the results.fm 13. select Do not create a form and click OK as shown in Figure 11-71. Figure 11-70 Create HTML Layout for report 14.On the New Parameters dialog. insert a report and reference the existing procedure Revenue for Selected Order Date 15.

Under Control Values.7214chHTML. 2010 1:15 pm Figure 11-72 Select parameter The Parameters pane appears on the right. Figure 11-73 Select procedure to control the values of the parameter 340 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. 17. select the procedure named parm sort procedure and click the Open button. From this dialog. select Procedures and click the ellipsis icon to present a dialog from which you can select the procedure.

Figure 11-74 Report with parameter values sorted in descending order Chapter 11.Close the HTML Composer session 20.Draft Document for Review January 3. 18.Return to the web browser and run the report Notice that the list is sorted in descending order by order date and only dates for the year 2007 appear on the list. the list of parameter values displayed in the drop down list will be controlled by the parm sort procedure report. This includes the sorting and filtering defined in this report.fm With this setting. 2010 1:15 pm 7214chHTML.Save the HTML 19. HTML Composer 341 .

fm Draft Document for Review January 3.7214chHTML. 2010 1:15 pm 342 Getting Started with DB2 Web Query for i .

Draft Document for Review January 3. Additional features of Developer Workbench In this chapter. There are many more capabilities within each of the features than is described in this chapter. All rights reserved. © Copyright IBM Corp. we cover the following additional features of Developer Workbench: Synonym Editor – – – – – – – Metadata Date decomposition Creating filters Joining tables Business views Impact analysis Data profiling SQL Wizard We provide a short tutorial for each feature so you can see how to use it. 2009. 2010 1:16 pm 7214chMRDextra. 343 . See the online help text in Developer Workbench for more details.fm 12 Chapter 12.

344 Getting Started with DB2 Web Query for i . or changing the length of a field. When the basic metadata exists. Within Synonym Editor. 2. “Online analytical processing” on page 257. you must use the Synonym Editor if you want to enhance the metadata or take advantage of the more advanced metadata capabilities. In our previous examples. but highly recommended. expand the metadata portion of the WebFOCUS Environments.fm Draft Document for Review January 3. In the right pane. we select cen_orders. select the table that you want to open in Synonym Editor. To start the Synonym Editor. 2010 1:16 pm 12. converting alpha to numeric fields.7214chMRDextra. If you plan to use the optional online analytical processing (OLAP) feature. In this tutorial. Right-click baseapp and select New → Synonym to invoke the metadata creation windows. This includes the ability to break dates down into their various components. then the developers never need to do this in the individual reports. Tip: Basic synonyms can be created from within Developer Workbench using the same routines that are used from the DB2 Web Query home page. Developer Workbench tool.1 Synonym Editor DB2 Web Query can create basic metadata from the DB2 Web Query home page or via the Synonym Editor in the optional. you must define your hierarchies or dimensions through the Synonym Editor. if we add commas and floating decimal signs to LINETOTAL in the metadata. you can change the way a field is displayed to the users. see Chapter 10. The Synonym Editor also allows you to create new calculated fields for the users. 1.mas. Other examples include converting date formats. Right-click and select Edit in Synonym Editor (Figure 12-1). Expand WebFOCUS Environments → your environment → Data Servers → EDASERVE → Application → baseapp. For more details about defining hierarchies for OLAP use.

such as DBSPACE.fm Figure 12-1 Starting the Synonym Editor The window changes to show the different attributes of the table that are stored in the metadata (Figure 12-2). are not applicable to DB2 for i5/OS. Look at the file attributes that are available. Additional features of Developer Workbench 345 .Draft Document for Review January 3. Some of the attributes. 2010 1:16 pm 7214chMRDextra. Chapter 12. Important: The Synonym Editor does not allow you to make any changes that render the Master file unusable.

7214chMRDextra. 2010 1:16 pm Figure 12-2 Metadata: Orders master file 346 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3.

Highlight LINETOTAL to see the metadata attributes of the field displayed (Figure 12-3). In this example. 2010 1:16 pm 7214chMRDextra.and column-level attributes Chapter 12. Selecting the ellipsis (three dots) next to these attributes allows you to specify which title you want displayed based on the language chosen.Draft Document for Review January 3. Additional features of Developer Workbench 347 . User’s can set up multiple titles for a column based on the language of the user. the report will use these settings by default. When we make this change.fm 3. we want LINETOTAL to display in reports with commas and a floating dollar sign. Figure 12-3 Field. Tip: The display in Figure 12-3 also allows users to specify a description and title for a column.

and formatting options that are available in DB2 Web Query to work with your integer field. If you have a field defined to DB2 as an integer 8 field that happens to contain the value 20070901. calculations.1. Using the powerful USAGE attribute allows you to specify a USAGE of type Date with a format of YYMD. For many System i customers. The ACTUAL for this column displays as integer 8. Figure 12-4 Date field attributes In the Attribute pane. This is a common requirement. USAGE allows us to override or change the length and attributes of a column from how it is stored and displayed by default. highlight and select ORDERDATE in the Column pane. 2010 1:16 pm Another interesting attribute on this display is the USAGE attribute (Figure 12-4). we have broken the date field into years. This enables many of the date and time functions. To demonstrate this. ACTUAL refers to how a column is stored in DB2 for i5/OS.1 Date Decomposition In many of the reports we have created so far. and months. USAGE refers to how the user sees and works with a column. To save you from doing this manually in every report. DB2 Web Query provides the Date Decomposition feature to automatically decompose the date in the Synonym Editor.fm Draft Document for Review January 3. there is no automatic way for DB2 Web Query to know that this is a date field. 348 Getting Started with DB2 Web Query for i .7214chMRDextra. USAGE becomes important for date fields. 12. quarters.

Draft Document for Review January 3. Figure 12-5 Decompose date column 5. Additional features of Developer Workbench 349 . 2010 1:16 pm 7214chMRDextra. Click OK. select all four subcomponents of ORDERDATE to be created for you. Right-click the ORDERDATE field and select Decompose Date (Figure 12-5).fm 4. Figure 12-6 Decomposed date Chapter 12. In the Decompose Date Column window (Figure 12-6).

We add a few suggestions for how you might want to work with dates that are stored in alphameric or numeric formats. First you highlight your date column. 12. Figure 12-7 Results of decomposing a date Note: You can manually create these fields by right-clicking a column or the table and specifying Add → Virtual column. Then modify the ACTUAL attribute from A8 to A8YYMD assuming that your date is stored in the format 20070914.1. 20070914 might be stored as a char 8 field. 350 Getting Started with DB2 Web Query for i . If you have a six-character field. such as PROFIT. notice that the system has generated four new fields for the users to access. That is. This allows you to create any new column that you normally create during the report definition stage. For example. We know that many System i customers do not store dates in the DATE format.fm Draft Document for Review January 3. You can also modify it to A8DMYY (Figure 12-8 on page 351) if you stored your date as 14092007. This also works if your date is stored as a numeric or packed field. In this case. you tell the system that you have a two-character year instead of a four-character year. you change the YY to simply Y. Creating it here means that it is available to all reports. Creating a column.7214chMRDextra. 2010 1:16 pm In the results shown in Figure 12-7.2 Additional date manipulation Our QWQCENT database stores dates in the DATE format. in the metadata means that the definition of the column is standard across all your reports. the date field is called DATEA8.

your users can now do basic date formatting. In a report. That is. SEPTEMBER 14. Any year from 40 to 99 is translated to 1940 . the format is similar to YYMD. then the additional two digits equal DEFCENT plus one. 2010 1:16 pm 7214chMRDextra. then the two additional significant digits in the year become equal to the default century value (DEFCENT). As shown in Figure 12-9. you can now use the PROPERDATE field to do date arithmetic or use date functions such as adding seven business days to a date or finding the end of the next quarter. The expression is your original numeric or alpha date field that you formatted as A8YYMD. If you use a century field.fm Figure 12-8 Defining your current character or numeric date field Having made these changes. the user can choose to format the field as a YYMTRD field. month.1999.Draft Document for Review January 3. Figure 12-9 Redefining a character date If you use two-digit years. Assume YRTHRESH equals 40 and DEFCENT equals 19. Chapter 12. and day in individual fields. you can use the DEFCENT and YRTHRESH column attributes to define your century. These functions are described in “DB2 Web Query date built-in functions” on page 555. you must first create an interim field that has the format of A8YYMD (or A6YMD) and equals YRFLD | MTFLD | DAYFLD. If the year is greater than or equal to the threshold (YRTHRESH).2039. This prints the date in the report as 2007. and day fields from this date. Then. you create a define field with your new date field name. Any year from 00 to 39 is assumed to be 2000 . month. using this interim field. If you store year. you create a true DATE field. The user can also create separate year. you can create your own formula in a define field to calculate a new date field correctly. If your two-digit year is less than YRTHRESH. Additional features of Developer Workbench 351 . you create a new date field as shown in Figure 12-9. To use various date functions and date arithmetic.

In this case. This allows us to easily run a report including European only countries. Figure 12-10 Adding a filter to a master file 7.3 Creating filters You can predefine standard selection criteria in the master file. 12. which exists in our T4_STORES segment. This means that we can test if for true or false in our reports.7214chMRDextra. 6. type Europe. this is the one that the users use in all their reports. we want to filter on the Country field. Right-click on the master file name segment that contains the field that you would like to filter and select Add → Filter as shown in Figure 12-10. we create a filter called Europe.fm Draft Document for Review January 3. In the Filter Calculator window (Figure 12-11 on page 353. In this example. This format opens up many additional date formatting and arithmetic functions. Note: Find the STORES segment because yours might not be T4. 352 Getting Started with DB2 Web Query for i . Double click on COUNTRY under the STORES segment to add it to the filter. and define it as an I1 (integer one long) column.1. This allows the criteria to be specified once and used in multiple reports. Change the Relations to CONTAINS because we need to provide multiple countries for the value. 2010 1:16 pm After you create your new date field. go to Column.

fm Figure 12-11 Creating a Filter 8. Additional features of Developer Workbench 353 . Figure 12-12 Creating a Filter Detail 9. Chapter 12. 2010 1:16 pm 7214chMRDextra. Double-click on the countries or use the > button to move the selections to the right hand side in the Value(s) Selection window (Figure 12-12).Draft Document for Review January 3. Verify that it looks like the filter in Figure 12-13 on page 354. Click OK to close the Value(s) Selection window and then click OK to close the Filter Calculator window.

We then join this table to the inventory table that we already defined. 354 Getting Started with DB2 Web Query for i .The filter is displayed in your list of column names when you create a report. but without selecting Foreign Key support.1. you can accomplish the same result for users who are using Developer Workbench. Drag the filter to the Selection criteria pane. 1. In Developer Workbench.4 Joining tables If you are unable to define foreign keys in your DB2 tables. we start by working with the Orders table without using foreign key support. 2010 1:16 pm Figure 12-13 Completed filter 10.fm Draft Document for Review January 3. A WHERE filter is true statement is generated by default. This create a cluster join where the two tables look like one to the user. Figure 12-14 Using predefined filter 12. Create another synonym for the Orders table. This report now includes only the countries that are defined in the Europe filter (Figure 12-14). In this example. Use either the DB2 Web Query home page or from within Developer Workbench.7214chMRDextra. Right-click and select New → Synonym (Figure 12-15 on page 355). expand WebFOCUS Environments → your environment → Data Servers → EDASERVE → Applications → baseapp.

Draft Document for Review January 3. select *LOCAL and click OK. Additional features of Developer Workbench 355 . since our table is a normal DB2 for i5/OS table stored on our local system. In the Create Synonym window (Figure 12-16). 2010 1:16 pm 7214chMRDextra. Figure 12-16 Creating metadata for local DB2 tables Chapter 12.fm Figure 12-15 Creating synonyms from Developer Workbench 2.

Then click Next.fm Draft Document for Review January 3. 2010 1:16 pm 3. select qwqcent.7214chMRDextra. Figure 12-17 Filtering synonym candidates 356 Getting Started with DB2 Web Query for i . Select the Tables check box and make sure that the Views check box is cleared. specify that the candidates for synonyms are the list of tables in the QWQCENT library. For Library. In the next window (Figure 12-17).

Additional features of Developer Workbench 357 . 2010 1:16 pm 7214chMRDextra. click Open (Figure 12-19). After you see the window that indicates that the synonym for the ORDERS table was created successfully.Draft Document for Review January 3. ensure that baseapp is selected and select only the ORDERS table.fm 4. We do not need to create a synonym for the INVENTORY table as we did that in an earlier exercise. for Select application. Do not select “with foreign keys”. In the next window (Figure 12-18). Figure 12-18 Selecting tables 5. Click the Create Synonym button. Figure 12-19 Successful creation of a synonym Chapter 12.

7214chMRDextra. 2010 1:16 pm 6. From the Modeling view. Figure 12-20 Adding a segment or secondary table 358 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. right-click ORDERS and select Add → Segment from Existing Synonym (Figure 12-20). If metadata for INVENTORY is not yet created. you can select Add → Segment Via Metadata Import. Most of the steps are identical. right-click the table icon and select Add → Segment from Existing Synonym. In Developer Workbench. Note: You can add your join from the Modeling view tab at the bottom of the window as well as from the Tree View.

fm 7. Additional features of Developer Workbench 359 . Click Select. Figure 12-21 Selecting the secondary join table Chapter 12. select cen_inventory as the table to join to ORDERS. In the Select Synonym window (Figure 12-21).Draft Document for Review January 3. 2010 1:16 pm 7214chMRDextra. DB2 Web Query creates a default join between the two tables.

change Multiple to Unique. Tip: If you are using the Modeling view.7214chMRDextra. you can either click the file icon or you can double-click the arrowed lines between the files to see the Join Properties. If you want to specify a one-to-one join. In the Developer Workbench window (Figure 12-22). In the left pane. Figure 12-22 Specifying Join Properties 360 Getting Started with DB2 Web Query for i . in the right pane. to see and possibly modify the join type and join conditions. for SEGTYPE. 2010 1:16 pm 8.fm Draft Document for Review January 3. right-click CEN_INVENTORY and select Join Properties. the join defaults to Multiple or a one-to-many join.

fm 9. With the Business View. You can choose to have a folder that contains all the elements of an employee’s address or you might want a folder that stores all your filters selected from the master file synonym. From this window. where Product Number from both tables is equal. fields can be grouped into folders for logical partitioning of the data elements. you lose many of the attributes that you changed. notice that DB2 Web Query has chosen an Inner Join. and so on. format changes.5 Business View The Business View allow you to define a logical view of your data typically to simplify ad hoc reporting for the user. Figure 12-23 Default join 12. These changes are not lost if you need to reimport the underlying table. The Business View also allows you to specify changes to your underlying table.Draft Document for Review January 3. the Business View enables you to add define and compute fields to a table so that all users have access to them in their reports. 2010 1:16 pm 7214chMRDextra. you can override the Join Type and Join Conditions you require.1. The new define fields or virtual columns can Chapter 12. In a view. In the Join Properties window (Figure 12-23). If you make these changes in the master file for the base or underlying table and you must recreate the synonym for that table. In addition. Additional features of Developer Workbench 361 . Click OK. you can simplify the fields in your master file. such as new column headings.

defined fields. you can create folders (right-click) and drag columns. Figure 12-25 Business View 362 Getting Started with DB2 Web Query for i .7214chMRDextra. 1. computed fields. The current user name can be retrieved using the GETUSER function. or filters to your view.fm Draft Document for Review January 3. 2010 1:16 pm contain system variables such as &DATE or the current user name. From the Synonym Editor (Figure 12-24). right-click cen_orders and select Create Business View. Create the business view shown in Figure 12-25. In the next window. Figure 12-24 Creating a Business View 2.

Draft Document for Review January 3. you can use Impact Analysis to determine the effects of the change on existing reports or business views. navigate to Common Domain. Tip: To see all reports that are affected across all folders and all domains. Additional features of Developer Workbench 363 . right-click one level higher on Domains.6 Impact Analysis If you are changing a table layout. To find the reports in the Common Domain that would be affected by a change to the Orders cluster. the user can open Power Painter and drag the entire business view to the Power Painter palette. This allows the user to basically create a one-step report.fm This view is now available to the user who is creating reports just like the original Orders table cluster is. 12. and select Impact Analysis (Figure 12-26). instantly creating a report that uses all the columns in the view.1. Figure 12-26 Starting Impact Analysis Chapter 12. Tip: If you create a business view for a user. 3. right-click. 2010 1:16 pm 7214chMRDextra.

double-click baseapp to see all our tables and views. 2010 1:16 pm 4. In the baseapp folder. Figure 12-27 Selecting a master file 364 Getting Started with DB2 Web Query for i . In the Open window (Figure 12-27).7214chMRDextra.fm Draft Document for Review January 3. select Cen_orders.mas and click Open.

Figure 12-28 Impact analysis results Tip: To find the business views that use a specific master file or column. you can either analyze the impact of modifying individual fields or find any report that references the cen_orders table. At this point.Impact Analysis window (Figure 12-28). Additional features of Developer Workbench 365 . click Analyze to find all reports that access any column in the cen_orders table. Chapter 12. All reports in the Common Domain that use the Cen_orders table are listed in the bottom pane.Draft Document for Review January 3. 2010 1:16 pm 7214chMRDextra. open the table in the Synonym Editor and right-click the table or column name and choose Impact Analysis.fm 5. In the Developer Studio .

In Figure 12-32 on page 368. To start the Synonym Editor. 2. The number of distinct values is calculated. expand the metadata portion of the WebFOCUS Environments. Choosing data profiling at the table level can take a while. you can see the four different patterns of postal codes that you have in your data. minimum. In our example. These patterns might be acceptable because the different patterns represent different countries or they might indicate data quality issues. After opening cen_orders in the Synonym Editor.1. Profiling allows you to see both the patterns in the actual text characters.7 Data profiling Developer Workbench provides the capability to profile your data. Every column in the table is analyzed.fm Draft Document for Review January 3. This is done by showing you the ten highest and ten lowest values in a column as seen in Figure 12-33 on page 369. and maximum values. average. right-click cen_orders and select Data Profiling (Figure 12-29). 2010 1:16 pm 12. Data profiling also shows the minimum and maximum values in a column and identifies ten possible outliers. 1. Figure 12-29 Selecting the Data Profiling option 366 Getting Started with DB2 Web Query for i . we profile all the columns in the cen_orders cluster table.7214chMRDextra. and the length of the data. The system looks at such items as patterns in the layout of the data in a column. Expand WebFOCUS Environments → your environment → Data Servers → EDASERVE → Application → baseapp. You can profile all the columns in a table by selecting Data Profiling or selecting an individual column to profile. The number and percent of null values in a column is also calculated.

Click POSTALCODE to see output similar to that shown in Figure 12-32 on page 368. Figure 12-30 Data Profiling results at a table level Chapter 12. You can profile an entire table. Notice that the fields in blue contain hyperlinks.Draft Document for Review January 3. and drill down into the various options. 2010 1:16 pm 7214chMRDextra. Another way to obtain these options is to directly profile the field. receive this type of a summary. hyperlinked chart. A summary report is produced like the example shown in Figure 12-30. Additional features of Developer Workbench 367 .fm 3.

Right-click POSTALCODE and select Data Profiling → Statistics.fm Draft Document for Review January 3. you can see either the values and patterns associated with POSTALCODE by selecting them from the data profiling submenu or by clicking the appropriate columns in the output report from the statistical analysis.7214chMRDextra. Return to the list of columns shown in Figure 12-31. Notice the different choices you have when profiling a field. Figure 12-32 Data Profiling results at the field level 368 Getting Started with DB2 Web Query for i . This time we profile an individual column rather than the entire file. Figure 12-31 Data Profiling selection at a field level In the Data Profiling window (Figure 12-32). 2010 1:16 pm 4.

switch to the QUANTITYINSTOCK column. Return to the list of columns (Figure 12-33). Additional features of Developer Workbench 369 . 2010 1:16 pm 7214chMRDextra."ProductNumber" = ORDERS. When the user chooses to run the report. The output is then presented to the user. Figure 12-33 Data outliers 12."CostOfGoodsSold") AS COGS FROM QWQCENT/ORDERS AS ORDERS. we have three different ways to provide SQL statements to DB2 Web Query. the SQL statements are run. You can directly access Report Assistant and Graph Assistant from within Developer Workbench. Data outliers are the ten highest and ten lowest values for a column."ProductCategory" ASC Chapter 12. INVENTORY."ProductType" ASC."LineTotal") AS Revenue. This is a similar technique to importing Query/400 definitions.fm 5. With the SQL Wizard. To see data outliers. SUM(ORDERS."ProductType". right-click QUANTITYINSTOCK."ProductNumber" GROUP BY INVENTORY. INVENTORY. we need SQL to import into DB2 Web Query: 1. After a report is tailored with one of the GUI tools."ProductCategory" ORDER BY INVENTORY. INVENTORY. Create a file on your PC hard drive called SQLStmt. One developer’s tool that is unique to Developer Workbench is the SQL Wizard.2 SQL Wizard In addition to working with the metadata. QWQCENT/INVENTORY AS INVENTORY WHERE INVENTORY. and the result set is passed to the reporting procedure for formatting and further modifications.Draft Document for Review January 3. In all cases. This file should contain the following statement. Developer Workbench includes report development tools.sql. it looks like a standard report to the user. SELECT INVENTORY. the SQL statement or SQL stored procedure is executed on the System i environment."ProductCategory"."ProductType". and select Outliers. and the temporary result set becomes the input to a query. SUM(ORDERS. You can then modify the output with Report Assistant or Graph Assistant. Before we start using the SQL Wizard.

If it is not displayed. Make sure that your Windows Desktop is displayed in your Developer Workbench explorer tree. 2010 1:16 pm Running SQL statements from a file requires the file to be in the DB2 Web Query directories in the integrated file system. see the Explorer options in 9. Figure 12-34 Moving PC files to DB2 Web Query directories 370 Getting Started with DB2 Web Query for i . 4. 3. Navigating in your Windows Desktop tree.7214chMRDextra. “Setting Developer Workbench default options” on page 254. 2. Open your explorer tree and expand down to Common Domain → Other Files. we use the functionality in Developer Workbench.2. highlight SQLStmt.sql and drag it from your PC to Other Files in Common Domain (Figure 12-34). Although there are many ways to copy your SQL statement there.fm Draft Document for Review January 3.

2010 1:16 pm 7214chMRDextra. create a file called SQL1. start the DB2 Web Query SQL Wizard. Figure 12-36 Initiating the SQL Report Wizard Tip: You can go directly to the prompt in Figure 12-36 by using the Quicklinks option of SQL-based reports and graphs.fm 5. Figure 12-35 Starting the SQL Wizard 6. In the Create window (Figure 12-36). Chapter 12. select SQL Report Wizard. Then click Create. Right-click your Tutorials folder.Draft Document for Review January 3. Now that we have the SQL that we want to run in the System i environment. for File name. and select New Procedure (Figure 12-35). For Create with. Additional features of Developer Workbench 371 .

you are presented with three options: – Include an external . 2010 1:16 pm 7. You can do this through the Create Synonym functionality in either the base product or optionally through Developer Workbench. 372 Getting Started with DB2 Web Query for i .sql file The . Figure 12-37 SQL Report wizard Tip: SQL stored procedures are not included in the SQL wizard because importing SQL stored procedures is part of the base product. Select Included from an external '.7214chMRDextra. – Type SQL commands directly This option allows you to directly enter an SQL command that will create a result set that can be used by DB2 Web Query – Import an existing .fm Draft Document for Review January 3.sql file and modify This is the same as the first option except you are presented with an additional display where you can edit the SQL statements in the file All options generate an internal.sql' file. The SQL statements in the file should generate a single result set. temporary file to hold the results of the SQL execution called SQLOUT. In the Welcome to WebFOCUS SQL Report wizard window (Figure 12-37).sql file must be located in the DB2 Web Query directories in the integrated file system.

Additional features of Developer Workbench 373 . you have the option to test the SQL statement against a limited number of records. In the Open window. Tip: Prior to continuing. As shown in Figure 12-39.sql file SQLStmt and click Open. Figure 12-39 Browsing for your .sql file Chapter 12. for the external SQL file name. in default HTML format. navigate to Common Domain → Other Files. Then click Next.fm 8.Draft Document for Review January 3. Figure 12-38 Accessing DB2 for System i data 9. to your display. click Browse. The output is sent. 2010 1:16 pm 7214chMRDextra. Select the . In the next window (Figure 12-38). Click Create. accept the default options for accessing the database.

review your options. notice that the input fields to Report Assistant are the output fields from your SQL execution. Instead of selecting a table you want to query. add a heading. create additional calculated fields.fm Draft Document for Review January 3. Then either select Report Assistant or Graph Assistant.COGS. and run your report.7214chMRDextra. such as PROFIT = REVENUE . Make some formatting changes. Click Finish. apply style sheets.In the Summary window (Figure 12-40). Figure 12-40 SQL Wizard option summary 11. you are presented with the output from the SQL. You can now choose to format the fields.In the window shown in Figure 12-41. and do anything else that you normally do to query a table in Report Assistant. Figure 12-41 Report Assistant with SQL output 374 Getting Started with DB2 Web Query for i . 2010 1:16 pm 10.

Chapter 10. We have tried to introduce you to the more common features within this product. you have been introduced to many of the features of Developer Workbench. You have now completed all the tutorials for DB2 Web Query. 2010 1:16 pm 7214chMRDextra. and this chapter. “Developer Workbench” on page 249. Chapter 12. Chapter 11. “HTML Composer” on page 289. We highly recommended Developer Workbench to DB2 Web Query developers. “Online analytical processing” on page 257. Additional features of Developer Workbench 375 .3 Summary Between Chapter 9. Developer Workbench is a complete GUI development environment. The help text accessed in Developer Workbench is much more detailed and complete than the basic help text that is available for the other Web components.fm 12.Draft Document for Review January 3. Feel free to experiment and remember that you can always turn to the help text if you need assistance. There are many additional features that we have not touched upon. Now it is time for you to start using this query and reporting tool against your own data.

fm Draft Document for Review January 3.7214chMRDextra. 2010 1:16 pm 376 Getting Started with DB2 Web Query for i .

clients can now do just that. we will look at how we can use these features to build a powerful dashboard inside Excel. However. many analysts have requested the ability to simply pull in the data from within Excel. While Web Query has always had tight integration for Microsoft Excel. In this chapter we will cover the installation and usage modes available inside the Spreadsheet client.fm 13 Chapter 13. they could run their reports and open up the output in Excel.Draft Document for Review January 3. All rights reserved. Using the DB2 Web Query Spreadsheet Client. conditional styling and formatting. © Copyright IBM Corp. DB2 Web Query Spreadsheet Client In this chapter. and formula support. From here. Finally. 2010 1:15 pm 7214chSpreadsheetClient. with items like drill downs. 2009. 377 . it has required that the user first go into the web interface. we will cover the DB2 Web Query Spreadsheet Client.

For Windows XP that is C:\Documents and Settings\userid\Application Data\Microsoft\AddIns\ and for Windows Vista® that is C:\Users\userid\AppData\Roaming\Microsoft\AddIns\ where userid is the user name they are logged into the PC as. 13.1 Overview DB2 Web Query has always had the ability to "push" data out to Microsoft Excel.2 Installation First make sure you have the latest copy of the Web Query media. Finally. This is a very simple text file that contains internal comments that explain how to work with the file.com" PORT = "11331" HTML_ALIAS = "/webquery_html" CLIENT_PATH = "/webquery/WFServlet" SERVER_END 378 Getting Started with DB2 Web Query for i .cfg file. this is off of the Tools > Add-ins menu. by using the Spreadsheet Client.mycompany. After installing the new feature. Install the latest PTFs for Web Query listed in the Info APAR. this provides a way for the administrators to set up all the existing connections in advance! This can be a great way to save on support calls from users typing in the wrong information. This allows them to avoid the trip out to the web browser to request the report and have it directed to Excel output.2. an Excel add-in is made available to clients in the IFS. 13.xla and wqsclient. Make sure the Web Query Spreadsheet Client option is checked. click the Office button. In versions below 2007. Once the XLA file is in the correct directory. launch Excel and go to the Add-ins Manager. End users simply copy the wqsclient. 2010 1:15 pm 13. Let's assume for example my server is myi. in the same manner the Developer Workbench is provided. the user simply launches Excel and requests the data from there.mycompany. Excel Options.7214chSpreadsheetClient. Add-ins. However. do not forget to add your license key for this option. If you are unsure. users can now pull data from Web Query directly from within Excel. where OPT01 is the name of your optical drive. The main items that administrators will want to add are server blocks at the end of the file. However.cfg files from /QIBM/ProdData/WebQuery/ibi/webfocus76/utilities to the Microsoft Office Add-in directory on their PC. Just add a block to the end of the file as shown in Example 13-1: Example 13-1 Server blocks example # Web Query server: SERVER_START PROTOCOL = "http" HOST = "myi.1 Predefined Server configurations One of the files listed above that users will move to their PC is the wqsclient. Users always have the option of entering their own server connection definition. This is a configuration file that allows the administrators to pre-define connections to their IBM i servers. Now the setup is complete and we will move on to usage.com. you can download the image from IBM's ESS website.fm Draft Document for Review January 3. Instead. In Excel 2007. Do a RSTLICPGM LICPGM(5733QU2) DEV(OPT01) OPTION(5).

13. DB2 Web Query Spreadsheet Client 379 .fm The only line that was changed was the HOST line. The only items not shown are those such as headers or footers that you can add directly in Excel. you will see a dialog box that provides almost all the same functionality you see in the Report Assistant inside the web version of Web Query.Draft Document for Review January 3. Simply add one of these blocks for each connection that you want. This means that you cannot set a parameter that can be selected at runtime. simply right click on the first cell you want to import data into or select the cell and use the Web Query menu or ribbon item. Because you have these designer/developer capabilities. we have two modes. you can select the measures that you want reported on as well as the grouping and ordering. are always the values that are entered. users of this mode must be an explicitly licensed user. The first mode is called 'Report Assistant' mode.1" PORT = "11331" HTML_ALIAS = "/webquery_html" CLIENT_PATH = "/webquery/WFServlet" SERVER_END 13.2.3. Besides DNS names. the selection criterion needs to be static at this time.3 Usage To pull data into Excel. The first dialog box will ask you for your server's name. At this point we will get one of two options. and path.168. If you go the Report Assistant route. protocol. The selection criteria are also set at this point. 2010 1:15 pm 7214chSpreadsheetClient. The purpose of the add-in is to simply pull the data set into Excel.1 Report Assistant mode To use the spreadsheet client. The next dialog will ask you to sign in with your user id and password. you will be presented with the Report Assistant form as shown in Figure 13-1 on page 380. However. port. Everything else. depending on your user licensing. This allows you to define your report on the fly. From here. Chapter 13. Select Create Query. alias. you can also enter IP addresses as shown in Example 13-2: Example 13-2 IP addresses example # Web Query server: SERVER_START PROTOCOL = "http" HOST = "192. The line that starts with # is just a comment. In this mode.

you will not be given this choice. to use SAF the end user may have an explicit license or may be a member of a Run Time Enabled group using 5733QU2 Option 4. In the SAF route. We recommend that you create a folder that contains nothing but the SAF Forms.Report Assistant or SAF. Select the form and fill in the selection criteria.3. You will not be re-prompted to allow for the values to be changed. refreshing the report will use the same values set. no other attributes of the report can be changed at this level. Here. Then use the 380 Getting Started with DB2 Web Query for i . SAF mode is similar to an HTML launch page. the developer builds an HTML Form and attaches that to an existing report. you will then be prompted with a list of available forms. However. Place all of the HTML Layout files in this folder. In addition. 2010 1:15 pm Figure 13-1 Report Assistant Mode 13. once the parameters are set and the report run. DB2 Web Query will populate the list of available SAF's by looking at a particular in a domain. if you do have a license allocated to your profile.fm Draft Document for Review January 3. If your profile does not have an explicit license. as you can only use the SAF mode. they are just running a report that already was created by a developer. This can be any folder you want.2 Structured Ad-Hoc Form mode The second mode of usage is known as 'Structured Ad-hoc Forms' or SAF. However.7214chSpreadsheetClient. When you select this method. Because of this limitation. you have the choice of which mode to use . This allows the end user to determine what values will be used for the selection portion of the report. the developer pre-creates an HTML form that provides the various drop downs and options to select. The end user is not actually creating a new report.

Look to the data bar feature of conditional styling to quickly pull out visual values Chapter 13.fm WF Console (http://yoursystem:11331/webquery_html/wfconsole.htm). Figure 13-2 Sample Excel Dashboard Once the data is returned into Excel.4 Dashboards in Excel With the Web Query Add-in. we automatically name the data ranges. the end user can do what they want with it. In order to make integration into Excel templates easier. Microsoft has made it even easier via the ribbon interface. you can only pull data over. For complete details. You cannot set more than one folder so you must place all forms to be used via the SAF mode into this one designated folder. DB2 Web Query Spreadsheet Client 381 . This is because Excel has always had excellent graphing capabilities. logged in as QWEBQRYADM. So if your data set contains 5 rows or 500 rows in the Sales column. we should think about first pulling in one or more data regions and then creating graphics in Excel based on that pulled data as shown in Figure 13-2. see the manual referenced at the end of this chapter. you can refer to them all simply as QDATA1__Sales. 13. This way you simply update the data in the sheet and Excel will update the images. This allows for access to various regions of the report without knowing the exact size.Draft Document for Review January 3. And with Excel 2007. not graphs. to select the domain and folder that contain the forms. There are several new features in Excel 2007 that make it more powerful than ever for data analysis. So when we think about creating composite dashboards. 2010 1:15 pm 7214chSpreadsheetClient. Check out features such as themes for building dashboards with consistent formatting.

576 rows and 16.048.216 cells) to 1. we want to check the option to preserve cell formatting.184 cells). it will take on the formatting in the template and not reset to the default format. This ability to do automatic refresh is a key feature if we want to use this as a dashboard. This way.179. there are several options we can set.536 rows by 256 columns (16. 13.ibm.fm Draft Document for Review January 3. please download a copy of the Spreadsheet Client manual from the Web Query Space located at: http://www. If we are using a template.869.7214chSpreadsheetClient.777. don't forget the increased limits on rows and columns.6 Spreadsheet Client Manual For complete details on using the Web Query Spreadsheet client. And of course. Figure 13-3 Data Range Properties 13. when data is added or updated. 2010 1:15 pm for numbers. We access these options via right clicking in the report data and selecting Data Range properties as shown in Figure 13-3.com/developerworks/spaces/DB2WebQuery 382 Getting Started with DB2 Web Query for i .384 columns (17.5 Data Range Properties Once we have the data into Excel. Here we can set features such as refreshing the data when the worksheet is opened and automatic background refresh. from 65.

But. active reports. In earlier chapters you learned how you can extend the value of the information stored in DB2 for i by doing online analytical processing. you can do the same with information stored in your Microsoft SQL Server databases. 383 . access to data stored in Microsoft SQL Server databases may also be key to creating desired reports. The Microsoft SQL Server adapter allows your organization to use a single query and report writing tool. All rights reserved. before we get started. dashboards and automatic report distribution. 2010 1:16 pm 7214chMSSQLAdapter. 2009. With this adapter. Adapter for Microsoft SQL Server The DB2 Web Query Adapter for Microsoft SQL Server extends your reporting environment by incorporating access to data stored in one or more Microsoft SQL Server databases. This chapter will take you through the steps necessary to establish a connection to your SQL Servers. By installing option 6 as part of your DB2 Web Query installation. you must install the option. © Copyright IBM Corp. to access all of the necessary data for your reports.fm 14 Chapter 14. Although the majority of your data is likely in DB2 on i. DB2 Web Query. you can seamlessly incorporate SQL Server data in your reports in real time without the need of a complex replication process. Current versions supported are 2000 and 2005.Draft Document for Review January 3.

1 or 1.7214chMSSQLAdapter. So now that you know which version of the driver you want to download. Log on to Web Query as a developer or an administrator 384 Getting Started with DB2 Web Query for i . Microsoft currently offers three levels of its JDBC driver. msutil. Use your favorite decompression utility. If prompted. not the Windows version.jar Once you have the JAR files. you need to FTP them in binary mode or use a mapped drive to them onto the system. and 2.2 version of the JDBC driver. To configure the adapter from DB2 Web Query.0 of the driver. the files are: msbase. Microsoft only finalized the 2. it is important to note that the settings are tied to the driver level and not the level of SQL Server. such as the open source 7-Zip.jar.1 of the driver. we can only configure it for one level of driver. You will also want to make sure you have the latest PTF group installed for DB2 Web Query.2 Establishing a connection to your MS SQL Server To configure the adapter within DB2 Web Query. This will download a tar/gz package containing the required Java Archives (JAR) files. Due to Microsoft's licensing agreements. Therefore.2 is also backwards compatible to SQL Server 2000 and forwards compatible to SQL Server 2008. if you are in doubt as to which version of driver to choose. If you have already purchased this option. to complete the installation you must install a version of Microsoft's JDBC driver for SQL Server on your system. When configuring Web Query. 14.2 version to connect to both SQL Server 2000 and 2005 servers. Version 1. follow these steps: 1.1 or 1. version 1. Web Query only supports the 1.2 of the driver. Even when you are defining the connection to the SQL Server 2000 server. If you have only SQL Server 2000 servers. Let's assume you are using the 1. version 1. we recommend the 1. please proceed.1 Installation To begin. you follow the settings for the 2005 server since those correspond to the 1. Luckily.1. it is just one: sqljdbc.2. For version 1.1 is designed for SQL Server 2000. By placing them in this directory. use your favorite search engine or Microsoft. Therefore. For version 1. either 1. As we are discussing configuration settings. At the time of publication.2 version as that will work with all levels of SQL Server. we need to have a brief conversation about versions. The JAR files must be placed into the Java Extensions directory located at /QIBM/UserData/Java400/ext. This option does have a 70 day trial.com to find links to the 1.2 versions of the JDBC driver.0 for SQL Server 2008. This directory is always included.0 version just before the General Availability date for this option.2 for SQL Server 2005. we recommend using version 1.2. If you are installing before purchasing.1 and 1. To determine which version to download. we are still working on adding official support for version 2.fm Draft Document for Review January 3. we are unable to ship required code as part of the Web Query package. 2010 1:16 pm 14. Searching for “Microsoft SQL Server JDBC Driver" usually returns the correct page at the top of the results.jar. please use the ADDLICKEY command to add the key to your system. to extract the required files. download the Unix version of the driver.2 version of the driver you are using. you must provide both connection and authentication information. mssqlserver. you must use version 1.jar. we do not have to worry about setting the proper classpath. Because of this. If you have only SQL Server 2005 servers. you must install the product option 5106 from media.

You will see two possible MS SQL Server versions (2000 for version 1. right click on a folder and choose Metadata from the menu. You will see an Adapters folder as seen in Figure 14-1. Under the Add Adapter Configuration in the Select Adapter to Add frame. 2010 1:16 pm 7214chMSSQLAdapter. Right click on Adapters and select Add or click the New Adapter menu item. 6. Chapter 14. Expand Reports folder in the domain.Draft Document for Review January 3. 4.fm 2. choose the version that matches the level of driver you installed. Click on the appropriate 2005 or 2000 version for your installation. which may not be the same as the level of SQL Server you are connecting to. 3. Expand the Domains folder and then select and expand a domain. Adapter for Microsoft SQL Server 385 .2 of the driver) represented. Figure 14-1 Adding a SQL Server Adapter 5. This opens the Configuration pane as seen in Figure 2. Again. Expand SQL and then the MS® SQL Server option.1 of the driver or 2005 for version 1.

2010 1:16 pm Figure 14-2 Configuring connection to SQL Server 7.rchland.2. However. First open up the Windows Task Manger. The final piece of this URL is the port number.7214chMSSQLAdapter. If you use a DNS name. make sure the IBM i can resolve it by doing a simple PING from the command line to the SQL Server's DNS name.0. This can be any name you want. In the configuration panel. the prefix is jdbc:microsoft:sqlserver.0:xyz.3. the port is 1547. prefix://hostname:port If you are using the 1. the separator:. Then open a command prompt and run "netstat -a -n -o" and look for the matching PID number. the separator ://. not all SQL Servers run on that port. Assume the DNS name of our SQL server is sqltest.2. do the following. To find your SQL Server's port number.ibm. the URL would then be: 386 Getting Started with DB2 Web Query for i . Enter the URL location for your SQL Server data source. Add the PID (Process ID) column by clicking View > Select Columns > Check the PID option > OK. This consist of the driver prefix. and followed by the host name (location) of the SQL Server. The URL would then be: jdbc:sqlserver://sqltest.0. the prefix is jdbc:sqlserver.exe and record it's PID. The default port for the SQL Server is 1433.fm Draft Document for Review January 3.com.com) or dotted IP address (1.1 version of the driver. In this example the Connection Name is called SQLTEST. The host name for your system can be either the DNS name (sqlserver.2 version (2005). Find the image name sqlservr.mycompany.ibm.rchland. Under the Local Address column will be 0. The value xyz after the colon is the port number.1 version of the driver (2000). 8. and the port. If you are using the 1.com:1547 If the above were the same but using the 1. you name your adapter as desired.4). in the format as follows. and the version of the driver is 1.

10.ibm.2 of the driver. 1.The final step is to enter the driver name.sqlserver.sqlserver. 2010 1:16 pm 7214chMSSQLAdapter. views. once you have established a connection to a data source. Therefore it is important that this profile is granted access to all tables to be accessed in the SQL Server. This. Adapter for Microsoft SQL Server 387 . Use the ENDWEBQRY and STRWEBQRY commands. 12. 2. In the Adapter pane you should now see your MS SQL Server as a data source.Web Query will find the necessary driver. 14.SQLServerDriver for the driver name.fm jdbc:microsoft:sqlserver://sqltest.jdbc.SQLServerDriver for the driver name.microsoft. This will be unique to your location. Again.Click on Configure once the appropriate information is provided. If you are using version 1. 13. 11. In this example.com:1547 9. right click the newly created connection and select Create Synonym as shown in Figure 14-3 on page 387.Do not be concerned that the CLASSPATH is NOT SET. Figure 14-3 Adapter panel Chapter 14. varied with the version of the driver. Select for Security the option Explicit and provide a SQL Server user and password necessary for authentication. you can create various synonyms over the data (tables.rchland. Test was not functional. too. stored procedures) at that data source that you want to query. a User of sqlserver and corresponding Password was provided. provided you posted the JDBC driver JAR file in the above directory location .microsoft.Once you have configured the new adapter you should restart the DB2 Web Query servers before moving on to create metadata. Note that at the time of this Redbook publication. All connections to the SQL Server will use this profile.1 driver. Yep. you guessed it. enter com. enter com. If you are using the 1. “DB2 Web Query fundamentals” on page 25. right click on a DB2 Web Query reports folder in the desired domain and select Metadata.3 Creating Metadata Just as in Chapter 3.jdbc.Draft Document for Review January 3.

SQL Server is different from the IBM i in that is has a concept of multiple databases. In this example. Figure 14-4 Identify the target database 4. In the second step.7214chMSSQLAdapter. This way.fm Draft Document for Review January 3. In this example. This will group all items from the HumanResources schema together and provide you with a quick reminder that this data source is from a SQL Server as shown in Figure 14-5 388 Getting Started with DB2 Web Query for i . Within each of those databases are then the schemas which contain the tables. Click the Next button to advance to the second step. your Employee table will show up as HumanResources_Employee_mssql. To define this synonym is a two step process. Remember. you select the tables you are interested in querying. First identify the target database on the SQL Server. Provide the prefix or suffix if desired and click on Create Synonym once you have selected the tables of interest. You will first see a panel similar to Figure 14-4. we have downloaded the Microsoft's AdventureWorks sample database so it shows up in the Select database list. the selection is key employee and department tables and specifying the With foreign keys option. 2010 1:16 pm 3. we recommend using the schema name followed by an underscore as the prefix and a suffix such as _mssql. In this example only table objects are requested from selected database. As a best practice.

Figure 14-6 Create synonym completion message 6.fm Figure 14-5 Selected tables of interest from the AdventureWorks sample database 5. Chapter 14. 2010 1:16 pm 7214chMSSQLAdapter. You now have a synonym that is specific to tables located in a database on a MS SQL Sever. exactly the same way you do with local data synonyms. Close that window. Adapter for Microsoft SQL Server 389 . Power Painter or Developer Workbench.Draft Document for Review January 3. You can now use this new synonym to build reports using Report Assist. Graph Assist. You will see a summary completion panel similar to Figure 14-6 on page 389.

fm Draft Document for Review January 3.com/systems/i/software/db2/webquery/gettingstarted.html Some of the information available in this document is: How to customize your SQL Server environment How to call SQL Server stored procedures Information about SQL Server data types 390 Getting Started with DB2 Web Query for i . 2010 1:16 pm 14.ibm.4 Additional SQL Server Adapter information To find additional information about the DB2 Web Query SQL Server adapter.7214chMSSQLAdapter. a documentation PDF file is located under the documents link on the DB2 Web Query Getting Started page located at: http://www.

“Software Development Kit” on page 417 © Copyright IBM Corp. “Report Broker” on page 393 Chapter 16. 391 . This part includes two of the companion products of DB2 Web Query: Chapter 15.fm Part 4 Part 4 Companion products In this part. we explain more specific topics on DB2 Web Query. 2010 1:16 pm 7214p04.Draft Document for Review January 3. All rights reserved. 2009.

fm Draft Document for Review January 3. 2010 1:16 pm 392 Getting Started with DB2 Web Query for i .7214p04.

distribution lists. printer destinations or for storage in a Web Query folder for shared on-line viewing or archival purposes. In this tutorial. DB2 Web Query. 2009. view distribution server log entries. it is tightly integrated with DB2 Web Query. establish schedule blackout dates and other Report Broker services are all presented to a Report Broker scheduler or administrator by logging in to DB2 Web Query. © Copyright IBM Corp. Look for icons with the question mark. 2010 1:16 pm 7214chReportBroker. A final point of integration between Report Broker and DB2 Web Query is the starting and ending of the Report Broker distribution server. view the various frequency options when scheduling a report. Start Web Query (STRWEBQRY). The scheduling function and the ability to view and change existing schedules. create and view distribution lists. Report Broker help text is context sensitive and will position you to the appropriate help for the corresponding screen or topic.fm 15 Chapter 15. Report Broker help text is available in the same language translations as DB2 Web Query. With Report Broker you can automate the process of running your reports and schedule them for distribution to individuals. This tight integration extends to the maintenance of Report Broker services as well. End Web Query (ENDWEBQRY) and Work Web Query (WRKWEBQRY) include the Report Broker distribution server as part of the command default '*ALL'. 393 . To see how the Report Broker distribution server fits into the DB2 Web Query architecture. we will go in to detail on how to schedule a report for distribution. To be a Report Broker scheduler or administrator you need the corresponding MRSCHEDULE or MRADMIN as a group profile in your user profile. see Figure 1-1 on page 11 in the architecture overview on Chapter 1. Although Report Broker is a separate licensed product. Report Broker services are included in the DB2 Web Query on-line help. Also.Draft Document for Review January 3. All rights reserved. All three CL commands used to start or end of Web Query services. show how to get failure notifications. once installed. Report Broker DB2 Web Query Report Broker is a separate licensed program product (5733QU3) that builds on the strengths of the web based query and reporting tool. a scheduler (MRSCHEDULE authority) needs to have developer access to one or more report domains. Regularly applying DB2 Web Query maintenance fix packs will also keep you up to date with any existing Report Broker fixes or new function.

Note that Report Broker only has a base option. you need to configure the product for use. You are allowed a 70 grace period to try out the product. issue ADDLICKEY CL command to apply the key.2 Installing and Configuring Report Broker Note: The most up to date information on installing and configuring Report Broker can be found on the DB2 Web Query Getting Started web page.fm Draft Document for Review January 3. QWEBQRYADM. We will show how to set schedule blackout dates.7214chReportBroker. do a global update and import a distribution list from another Broker server. the same steps can apply to that report. 5. Open the report for edit and click on Selection criteria and remove the input option at this time. 15. the base option. if it contains a prompt for input of Product Type. You only need to do this once per installation. That said. you need to already have installed DB2 Web Query V1R1M1. it must first be installed and configured for use. After installing Report Broker. If you have an existing report of your own that follows the report criteria similar to that of the one being scheduled in this tutorial. To do this configuration you must sign in to the DB2 Web Query Administration console as QWEBQRYADM. if you have an existing report of your own that follows the report criteria of the one being scheduled in this tutorial. Report Broker uses underlying DB2 tables to store schedule requests and other information. 2010 1:16 pm create a distribution list. like distribution lists. Issue RSTLICPGM specifying your optical device. enable a report for a capability known as intelligent bursting and view the log entries for a scheduled distribution. we will cover some Report Broker capabilities specific to the MRADMIN authority level. 15. In order to use Report Broker. As you click on that report to run it. Signon as QSECOFR or a user profile with *SECADM or *ALLOBJ authority 3. If you have a license key for 5733QU3. you should remove that value as well. and you should be up to date with DB2 Web Query maintenance fix packs. End the existing Web Query services (ENDWEBQRY) 2.1 Tutorial Overview and preparation To facilitate this tutorial we will reference a predefined reports already created in the Report Assistant section call RA4_Advanced. The distribution server queries these tables using the DB2 Web Query administration profile shipped with the product. The Web Query servers must be started to do this. RSTLICPGM LICPGM(5733QU3) DEV(opt01) 4. If you output the product type in the Report Headings. Only by logging in as QWEBQRYADM will you be able to see the Report Broker configuration options in the side panel as illustrated in Figure 15-1 on page 395. To install Report Broker. Read the license agreement and press F14 to accept it. the same steps can apply to that report.htm 394 Getting Started with DB2 Web Query for i . In addition. 1. The URL again for the console is: http://<yoursysname>:11331/webquery_html/wfconsole.

due to password policies at your location. You will receive a message when the tables are successfully created. the name of your E-mail server. it could be the password in not correct. The first step is to establish the Connection settings needed by the Report Broker repository. To test the connection profile and password are correct.fm Figure 15-1 Report Broker configuration 1. your email host server name in the Mail Host value. the Default Mail Reply Address value and most importantly. 3. The next step is to create the underlying DB2 tables used by Broker. Click Save. It is recommended you minimally set the Default Mail From value. You will get a pass or fail indication. Report Broker 395 . You may need to click Test Repository a couple of times before getting a Pass indication. and a handful of other settings. Click on Connection and provide the QWEBQRYADM profile and password and then click Save at the bottom of the screen. You have the ability to request email notification for reports that fail to distribute. how often you want the distribution server to wake up and look for scheduled requests. Tip: Because the Report Broker Distribution Server will regularly connect to the local database to poll for schedule requests using QWEBQRYADM profile and password. Click the option Create All Tables.Draft Document for Review January 3. Chapter 15. 2010 1:16 pm 7214chReportBroker. It is on this screen that you determine key aspects of how the distribution server will run on your IBM i. The Notify Mail Host will be equivalent to the Mail Host value unless you designated a different server. if that password is changed. what name and email reply address you want to default on the delivered reports. For example. click Test Repository in the side panel. how far back you want the distribution server to recover 'missed' reports should the server be down. Click on Configuration. See Figure 15-2 on page 396. 2. If you persist in getting a Fail. you must immediately update the Report Broker configuration with the new password. Failure to do so will quickly render QWEBQRYADM profile disabled and that will prevent both Report Broker schedule requests and DB2 Web Query user logins from being successful. The final step is to set the necessary Report Broker configuration settings.

2010 1:16 pm Figure 15-2 Configuring Report Broker The distribution server also keeps a detailed log of all distribution activity. The Log Purge Period is the number of days the log entry is retained. click Help to get additional information about the settings provided. By default the configuration setting allows 30 days log retention. who received the reports. 396 Getting Started with DB2 Web Query for i .7214chReportBroker. and any problems encountered during distribution. You also have the ability to automatically recover missed report distributions should the Report Broker distribution server be down. To determine the appropriate configuration setting options for your environment. The Log Purge Time is the time of day when Report Broker purges expired log entries.fm Draft Document for Review January 3. what reports were generated and distributed and when.

Chapter 15. 1. Right-click on RA4_Advanced and choose Schedule as shown in Figure 15-4 on page 398.fm Figure 15-3 Help for Additional Information 15. 2010 1:16 pm 7214chReportBroker. you must first identify the report to be scheduled. Report Broker 397 .3 Schedule an existing report To schedule a report. In this example we will select the report by expanding Common Domain then Reports then Tutorials folder and find the report call RA4_Advanced.Draft Document for Review January 3.

You can Save the schedule. If you exit the panel without doing a save. Run the schedule.fm Draft Document for Review January 3. you will be asked if you are sure. or request Help or the panel.. Note that along the top you have a menu bar with several options. 398 Getting Started with DB2 Web Query for i . view schedule Log entries.7214chReportBroker. 2010 1:16 pm Figure 15-4 Report Broker Schedule Clicking Schedule will present the Report Broker Schedule panel as is illustrated in Figure 15-5 on page 399.

Draft Document for Review January 3. The Web Query option allows you to schedule and store the resulting report in a Web Query folder. generated reports can be viewed by multiple Web Query users without Chapter 15. You have the choice of Email. Printer or a Web Query distribution. These are reflected in the Distribute report by option. Using the Web Query distribution option. you could designate that in the description by providing 'Monthly Management Gross Profit Product Report'. The schedule panel consists of five key sections: Distribution Frequency Report Options Notification Advanced Note that all required fields in all of these sections are designated by an * asterisk The Distribution section indicates how and where the report will be distributed. Report Broker 399 . 2010 1:16 pm 7214chReportBroker. This description becomes the name by which this schedule request will be known on the Report Broker tab for any future actions on this request. For example if this is the monthly gross profit report by product type sent to upper management.fm Figure 15-5 Report Broker Schedule options The Description supplied at the top of the schedule panel is primed with the name of the report selected and the current date and time. The folder name is supplied by the schedule request and will become part of the same report domain as the original scheduled report. You can change this description to reflect key aspects of the report.

fm Draft Document for Review January 3. For now. It is unlikely that you would want the subject of a repeatedly distributed reports to reflect the initial create time of the schedule request so clear that portion of the subject line or clear the entire subject and provide a more meaningful subject. 4. we will choose to distribute the report as an Excel spreadsheet as shown in Figure 15-6 on page 401. On the Distribution list pull down. select Single Address and supply your own email address in the required field location designated by *. Based on the type of report being distributed. The Frequency section determines when and how often the report is distributed. we will leave that box unchecked. 400 Getting Started with DB2 Web Query for i . As the RA4_Advanced report was created with Report Assist. select the Email option 2. like 'My first Report Broker schedule request". You have the option to add reports to the zip file. By default. The Subject of this report distribution is primed with the name of the selected report being scheduled and the current date and time. a Report or Graph. We will talk about the Burst this Report option in another example but another important option here is the Send the Report in this Format designation. we will leave that frequency setting to Once. The Web Query option is also a good way to generate an archive of reports. Tip: If you receive a popup message of MSGV0004 on the Save or Run of a scheduled distribution by Email it means your the Mail Host server was not properly configured. 3. We recommend that newly schedule reports be set to run Once and to a test distribution email address (like yours) to make sure the subject and additional report options are at desired settings before scheduling a report to deliver to multiple people. different format options will present themselves.7214chReportBroker. we are going to distribute a report by email. By default the Run Interval is Once on a create and it is primed with the current date and time. Under Distribute report by. The From and Reply Address of the report are primed with the values supplied when you configured the Report Broker server (see Figure 15-2 on page 396). 5. In this example. 2010 1:16 pm each rerunning the report. 1. As this report is small. You can override those values if you wish. See Figure 15-2. Under the Report options section you designate how you want the report to be distributed. Even though RA4_Advanced was defined as an HTML report in Report Assist. you see the allowable options for distributing a text based report. 6. by clicking the Add Reports to Zip File. the report is Sent as an attachment. however.

Click on the Notification will be sent out and the Type drop down to view the options available. default priority and enabled. Note that the Subject is populated with the subject of the original report. 8. if the input parameters were defined in the report as Prompted. you further extend the value of your highly parameterized reports 9. 2010 1:16 pm 7214chReportBroker. we will leave these two sections at the default values of no notification. The Advanced section allows you to temporarily disable a schedule report or change the priority of a schedule. and then is deleted. Never get a notification or get one only On Error. verify that this format option is compatible with the initially created report. at some future date and time. The Notification section allows you to specify if and when you want failure notification and who should receive that notification. Note: Although this report being scheduled does not have any input parameters. an attachment name is predetermined. Refer to Figure 15-7.Draft Document for Review January 3. You can choose a different name if a more meaningful one would be helpful for you target audience.fm Figure 15-6 Report as Excel spreadsheet 7. Take the pull down and select EXL2K FORMULA . particularly for Graph reports or reports targeting printers. the Report Options section allows you to Check and select parameter values required as input parameters when a report is defined with inputs. those same prompted values will be displayed here for your selection. You can Always get a notification. By scheduling a parameterized report multiple times with different input values. You should change the subject to indicate the appropriate notification state.Microsoft Excel 2000 Formula. Because this report is scheduled to be delivered as an attachment. In fact. Tip: If you have trouble with your distributed report not opening or displaying correctly. A schedule's priority determines which report is served first when multiple reports are scheduled at the same time. The name of the parameter field(s) and value(s) when provided would be stored with the report. Full Notification and Reply Address. If you designate notification. The Delete this schedule option gives you the capability to schedule a report designed to run once. you will be required to provide a To and From email address. Report Broker 401 . designating different target distribution lists and in a preferred format and on a scheduled basis that works best for that target audience. For this example. Chapter 15. Expand the Notification and Advanced sections of the schedule panel.

fm Draft Document for Review January 3. Open the email and you will see a spreadsheet attachment that reflects the Gross Profit by Product Type report.To find the schedule request just created. Figure 15-8 Confirmation message Within a minute or two. 402 Getting Started with DB2 Web Query for i . check your email.Click the Save button at the top of the schedule panel. 10.4 Scheduling Frequency options We will now find the report we just scheduled and experiment with the different Frequency options available in Broker. 11. 2010 1:16 pm Figure 15-7 Notification options Now that we have defined our report to run Once and distribute to a single email address which is your own. You will see confirmation of your create as shown in Figure 15-8.7214chReportBroker. This will both save your report for future use and run your report once. 15. the RA4_Advanced report should be in your email. click on the Report Broker tab as illustrated in Figure 15-9 on page 403.

Delete a schedule.To schedule a report to run every day of a normal work week. Report Broker 403 . Note that if you have MRADMIN authority.fm Figure 15-9 Schedule requests Notice there are two menu bars in Figure 15-9. perform some Change Mgmt and work with Blackout Dates. Figure 15-10 Frequency . check current running Status. select the settings as seen in Figure 15-11. 2010 1:16 pm 7214chReportBroker. Clone (copy) a schedule. The second menu bar relates to existing Schedules. 13. work with Distribution lists. The top menu bar lists various thing you can do in Report Broker like work with Schedules. you have the ability to see ALL schedule requests by clicking on the Filter option.Draft Document for Review January 3. By default you see all the scheduled requests you creates as a profile with MRSCHEDULE authority. at 6AM. Again you will again see the Schedule panel. From this menu bar you can Open a schedule. do Global Updates. view a schedule's Log.View the various schedule option under the Run Interval tab and select Weeks as shown in Figure 15-10.Run Interval 14. Now let's play with the various frequency options available to you. view the schedule list by applying a Filter option.Open the scheduled request by double clicking on the selected schedule. working with Schedules is the active option and you see the existing schedules. Chapter 15. By default. 12. Purge log entries. Run a schedule. Monday through Friday.

You can apply a secondary run interval every n minutes or hours after the initial Run Interval is triggered.Run Interval 15.fm Draft Document for Review January 3. The secondary run interval is available for schedules that run daily. 2010 1:16 pm Figure 15-11 Frecuency . In addition to a primary schedule. Note that cloned schedules are automatically marked disabled until you enable them under the Advanced settings section.Now. lets change the Run Interval to Months 16. weekly. select both dates in the setting as seen in Figure 15-12. quarter or year. 404 Getting Started with DB2 Web Query for i . two separate schedule requests would be necessary. To schedule the same report to run on both a first Monday and a third Thursday. use the Clone option mentioned above under the main Report Broker Schedules menu. per month. To facilitate copying the same schedule request for slight alterations.Click on the Apply secondary run interval illustrated in Figure 15-13 on page 405. you have the ability to schedule a secondary run interval 17.To designate that a report run on the 1st and 15th of each month. Figure 15-12 Selecting dates Another option on this same screen is to designate that a report run on The (radio button) first Monday of the month or the third Thursday.7214chReportBroker.

click on the Distribution List option. In this example we are going to create a distribution list to facilitate the bursting of the Gross Profit by Product Type report (RA4_Advanced). Report Broker 405 . Creating a distribution list is particularly helpful when you want to use a function within Report Broker known as intelligent bursting. so that each separate product type (Audio. 1.5 Creating a Report Broker distribution list As noted in the Schedule report example defined earlier. as noted in Figure 15-14 on page 406.Click Save. 2010 1:16 pm 7214chReportBroker. Product category. when distributing a report you can send the report to individual email addresses or to a pre-determined distribution list defined within Report Broker. etc) will have that section of the report sent to the person responsible for that product line. From the DB2 Web Query page. This list shows you all distribution list that you created that are private for your use and those that are designated public Chapter 15.Draft Document for Review January 3. Video. or any one of a number of possible values given your reports. Change the report back to Run Interval . 15.fm Figure 15-13 Applying a secondary run interval 18.In order to make schedule change permanent. From the Broker menu bar. The process of report bursting is one in which a report is broken into sections and those sections are distributed to particular recipients. For reports defined specifically for bursting. you must save the schedule request. click on the Report Broker tab. This could be County.Once 19. 2. this Sort By value could also be hidden from the main report and one that is a composite of a couple of report values when a standalone value is not definitive enough. Sales Region. Bursting works by segmenting the report based on the first Sort by field of the report.

Distribution lists can also be of type Email or Printer.fm Draft Document for Review January 3. You can create a distribution list (New). and Delete a distribution list 3. Tip: Note that the match of the burst values in the distribution list to the corresponding section of the report noted by the first Sort by is case sensitive and an exact match is required 406 Getting Started with DB2 Web Query for i . 6. multiple line protocol printers can be the target for your reports. Open for edit or view. In this case we will be creating an Email distribution list. Similar to example in Figure 15-16 on page 407. you will notice the options available for working with Distribution Lists. Figure 15-15 Distribution list pane 4. List the various product types (Audio.7214chReportBroker. Distribution lists can be public or private. Video. A private distribution list is only available to the scheduler who creates it. where the printer name is designated as queue@printserver. The create distribution list panel looks as follows in Figure 15-15 on page 406. Note that Printer distribution lists can also be the target of bursted reports. 2010 1:16 pm Figure 15-14 Distribution lists Under the main options bar. Keep the Access as public and the Distribution method as Email. Click the New button to create a new distribution list. In the case of a Printer list. Provide a name for you Distribution list. such as ProductTypeDist. etc) in the Burst Value column and provide a corresponding Destination email address or addresses for that burst value. 5.

inserting and deleting list entries. click Save. let's reopen our existing schedule request and designate a bursted report. 2010 1:16 pm 7214chReportBroker. Once you have complete filling in the distribution list. By default the existing Schedules are presented. Figure 15-16 Saving a distribution list You can maintain a distribution list.Draft Document for Review January 3. 15.fm 7. 1. double-click on the RA4_Advanced schedule request bringing up the Schedule panel as filled in previously. In the Report Options click on the Burst this Report setting as shown Figure 15-17 on page 408. 2. Chapter 15. Change the Single Address option to Distribution List and select the new ProductTypeDist list. 3. by clicking within the list and selecting the Insert or Delete menu option. From the DB2 Web Query page. Report Broker 407 . click on the Report Broker tab.6 Busting a Report Now that we have a distribution list to facilitate intelligent busting. 4.

2010 1:16 pm Figure 15-17 Burst this report option 5. You will be prompted to confirm that you want to run the report Off schedule as shown in Figure 15-18 on page 409. After confirmation of the save.7214chReportBroker. To run this report. click Run immediate on the Schedules menu bar. Click Save. you now have a schedule request saved that bursts a report and targets a distribution list. 408 Getting Started with DB2 Web Query for i . 6.fm Draft Document for Review January 3. Click Yes.

if Country was a required input in to the report. Also note that a distribution list with Burst values can be used if no bursting is requested on the schedule. Similarly. If a distribution list is not provided with Burst values and the Burst this Report is checked. Each member of that distribution list would receive the full report. with parameterized report. Tip: Burst values can be embedded in the subject line of a distribution by using '%burst' in the subject. '&Country' would provide that country value in the subject line. Figure 15-19 Status option Note that a distribution list is not required for selecting intelligent bursting.Draft Document for Review January 3. From the status screen you can view currently running distribution requests and you have options such as removing a running report or changing a priority as shown in Figure 15-19 on page 409. Chapter 15. For example.fm Figure 15-18 Running a report Off Schedule If you are quick enough. the supplied input value(s) can be embedded in the subject line of the distributed report by using '&parmname'. Report Broker 409 . you can click the Status option along the main menu bar and see you running report. 2010 1:16 pm 7214chReportBroker. the report will still be segmented in to the leading Sort by sections and sent as individual attachments to the designated email addresses.

8.fm Draft Document for Review January 3. 7.7 Viewing the Distribution log Each time the distribution server runs and distributes a report. the time and the target distribution. You could also choose a date range or all log entries for this schedule. 2010 1:16 pm 15. This log can be viewed for audit purposes or as a source for troubleshooting an initial or changed distribution request which does not appear to be working as desired. select the desired schedule and then click Log as designated in Figure 15-20. By default. 30 days of distribution activity is maintained in the log. Click Ok to see the Log entry for the Last Executed. If problems were encountered generating the report or connecting to the email server or connecting to a remote database. The entry designates the report that was distributed. This brings up a dialog box. that information will be denoted in red. The retention period for the log is specified in the Report Broker configuration and can be changed. it creates an entry in the distribution log. To view the distribution log for a particular schedule request. 410 Getting Started with DB2 Web Query for i . Figure 15-20 Log options Each log entries look similar to Figure 15-21 on page 411.7214chReportBroker.

2010 1:16 pm 7214chReportBroker. By clicking on each specified input parameter. you press run. State via auto prompting and specify a date range used in the generation of the report. your report consumers can get the report they want. Figure 15-22 illustrates the defined parameters for an existing Gross Profit report.fm Figure 15-21 Job Process Log 15. Figure 15-23 illustrates how a report scheduler selects the appropriate report parameters. After selecting inputs. just by using Report Broker. With Report Broker you can schedule that same highly parameterized report multiple times and just by selecting different input values and designating a different target distribution list you can reuse the same created report to meet the needs of lots of report consumers. Report Broker 411 . Region. In fact. you select the Country. Figure 15-22 A highly parameterized report’s input prompts Report Broker also allows you to provide parameter values on a schedule request.8 Report Broker and Highly Parametrized reports As mentioned earlier in the Redbook. If auto prompting Chapter 15. We call this a highly parameterized report. In fact if the report is parameterized you must provide valid parameters within the schedule request so the report can be generated in the batch distribution environment. Given the parameters defined. you will either be provided an auto prompt pulldown list for your selection or an input box for providing manual values. when they want it. you can add a number of parameters to a report and there by have one report serve multiple target audiences just by varying the input values.Draft Document for Review January 3.

2010 1:16 pm was made possible on the report creation. 3.9 Report Broker Administrator functions A Report Broker user with MRADMIN authority is able to do three additional Report Broker tasks that a MRSCHEDULE user cannot. Note that when you manually enter report parameters. for example.7214chReportBroker. January 1. Click the menu bar option Blackout Dates From the schedule blackout date panel as shown in Figure 15-24 you can navigate to a different calendar year. In this example. To make the date a non-blackout date. 412 Getting Started with DB2 Web Query for i . the values provided must be an exact match of the data stored or your report could come up short on data. in this case 2009. you are presented with the current calendar year. do global updates and perform some change management functions. To schedule a blackout date just click the date. It will go gray. just unselect the date. Country. Figure 15-23 Report scheduler 15. To set schedule blackout dates 1. that same prompting is available during the report scheduling. Click the Report Broker tab. Region and State are auto prompted and the From and To date range is manually designated by the scheduler. An administrator can schedule blackout dates. By default. Sign in to DB2 Web Query with an MRADMIN authorized profile 2.fm Draft Document for Review January 3.

2010 1:16 pm 7214chReportBroker. click OK.fm Figure 15-24 Blackout dates 4. you can perform a limited type of global update. These updates are unqualified. Click the Report Broker tab 6. Then click Update. As an administrator. if Tom is leaving the company and all his existing reports should now go to Sue. So. Click the Save button when you have determined the desired blackout dates MRSCHEDULE authorized Broker users can view the scheduled blackout dates but cannot alter them. you could perform that type of update by doing the following: 5. Report Broker 413 . You will be prompted to confirm the update as shown in Figure 15-25 on page 414. so they are an ALL or nothing determination. Chapter 15. Provide the Old Value email address and a New Value email address for Tom and Sue.Draft Document for Review January 3. Click the menu bar option Global Update 7. for example.

Figure 15-26 Connecting to another server 1. for example. Figure 15-26 on page 414 show how you configure the connection to that other server.7214chReportBroker. via a DB2 connection. 2010 1:16 pm Figure 15-25 Confirmation window The global update request will change the appropriate columns in the DB2 repository tables that reflect email addresses. Click the menu option Change Mgmt 414 Getting Started with DB2 Web Query for i . Change management allows you to poll another Report Broker repository. and will report back the number of changes performed. that instead of creating the distribution list used previously you want to import that distribution list from another Report Broker server. If a printer changes or an existing email server changes. and present the existing public Distribution lists from that other server by the user that create the lists.fm Draft Document for Review January 3. you can update all existing reports to the new value with one global update request. The final administrator task is one of change management. Say.

as shown in Figure 15-27. the number of licenses your organization needs for DB2 Web Query can depend on many things.fm 2. With Report Broker. the active report recipient would not need to log in to DB2 Web Query to manually generate and save the report. Provide the necessary connection information by providing the location of the other broker server in the Source URL and a User Id and Password needed to connect to the repository. Report Broker 415 . or if control over when queries of the data are run is important. Figure 15-27 Importing distribution lists 15. 3. A summary panel reflecting the import will display the results of the transfer request. real time access to the report data. Instead. like how many people will be developing reports versus the number of users or distinct report domains are necessary for those just viewing reports. Click to close that window. the active report could be scheduled to automatically run at a designated interval convenient for the target audience and automatically sent as an email attachment in AHTML format via Report Broker. Click the desired distribution lists and click Insert. it was discussed how an Active Report could be generated and saved to a local PC and then sent as a file attachment via email to mobile users. Your mobile users would never need to see a DB2 Web Query screen and would never need to wait for the report to be generated. You can now use this distribution list on future schedule requests. Chapter 15. One aspect of that decision is also whether or not your report recipients need live. Click the user whose distribution list you want to import and you will be presented with the corresponding distribution lists. 2010 1:16 pm 7214chReportBroker.10 Report Broker and Active Reports In the summary of the chapter on Active Reports. then click OK. then Report Broker is another option. real time access to data. If most of your users do not need live. 15.11 Report Broker and RunTime User Enablement As mentioned in the runtime enablement discussion.Draft Document for Review January 3. 4.

support for parameterized reports. and a user id. which defaults to *CURRENT. 15. 416 Getting Started with DB2 Web Query for i . triggering a report distribution after some lengthy batch processing has completed. such as intelligent bursting. giving them the information they need. give you the ability to schedule a report for a multitude of users. when they need it and in a format that compliments the way they want to work with data. unique Broker Schedule Id. You can use this CL command in your application code or database triggers or any scenarios where you can test for or determine a condition where you would like a schedule to be run. a CL command called RUNBRSCHED gives you the capability to run a schedule request outside of Report Broker. The inputs to this command are the 12 character. 2010 1:16 pm 15. For example.fm Draft Document for Review January 3. along with customized distribution lists.7214chReportBroker. flexible output formats.12 Event driven distribution request via RUNBRSCHED One question often asked of Report Broker is. Report Broker features.13 Report Broker Summary You have now completed the tutorial of Report Broker function. But. Report Broker is a tool that extends the value of DB2 Web Query by allowing you to distribute batch-generated reports to your target audience without requiring the target audience to know about or ever log in to DB2 Web Query. as seen in Figure 15-9 on page 403. "Can a schedule request be triggered by a condition or event?" Currently there is no support in the Broker scheduler to put a condition on a request that could be polled prior to a batch generation and distribution of a report.

fm 16 Chapter 16. All rights reserved. 417 . Software Development Kit In this chapter. 2009. Please note that this feature is only available to customers running version R111 or higher of Web Query.Draft Document for Review January 3. we will introduce you to the optional Software Development Kit (SDK) for DB2 Web Query. Finally. This feature allows companies to build software products that harness the power of Web Query. we will cover the requirements for use. © Copyright IBM Corp. We will explore the various ways to use the SDK in your shop. 2010 1:16 pm 7214chSDK.

We have modified an RPG application to call the Web Query SDK. ISV’s have inquired about harnessing the power of Web Query into their applications.fm Draft Document for Review January 3. product 5733QU4. the URL is a hot link. And the possibilities are endless! With the SDK. 2010 1:16 pm 16.it simply appears as a client-server type application. we have integrated the power of Web Query.1 Overview of the Software Development Kit (SDK) DB2 Web Query comes complete with a web-based interface into the product.2 Uses of the Web Query SDK In this section we will provide a few of the common uses for the SDK. 418 Getting Started with DB2 Web Query for i . they have the right to develop on top of Web Query and then sell that application. This allows you to provide an experience that is completely branded as your own. The users purchasing the application would be required to have Web Query installed and licensed.or extranet users a profile? Build your own page that displays the results using a single embedded user id and password that the user never sees! Want to make your existing web apps more powerful? We have taken the popular open source software program SugarCRM and modified some of the basic opportunity screens. but would not need to purchase the SDK. Only the entity creating the application needs the SDK. This is by no means an all inclusive list. One final example could be an ISV that builds an application. Web Query requires a user profile to the IBM i system to login. An application developed with it will run on any Web Query instance. Web can be easily integrated into PC-based as well as web-based programs. This also allows you to integrate reports and graphs into your existing web infrastructure. 16. Are you limited to using green screen telnet connections? Not to worry.7214chSDK. Rather than building their own reporting and graphing facility. To satisfy this need. If you rather not use the web at all. Here. In addition. the industry standard for Service Orientated Architecture (SOA). they could build their application on top of Web Query. Don't want to give all your intra. This small change to base SugarCRM application has now dramatically increased the usability of the data it stores. By the ISV purchasing the SDK. However. you can quickly build a PC-based application with a language such as VB. Now. instead of pulling a boring static list of contacts. Using the hotspot capabilities of IBM Personal Communications. We are now providing interactive Active Reports as well as graphs of the various opportunities and potential to close. your users are not even aware they are using a web application . IBM released the SDK for Web Query. put the reports directly in your existing intranet site. The output is a PDF file that we write to the IFS and then post the URL on the screen. Rather than sending users to login via http://system:11331/webquery. Because of this. This product provides a set of web services accessible via SOAP. This means from our green screen app we can launch a PDF showing more details for our transaction! See this below in our sample screen shots. These samples are provided simply to give you some ideas of how the SDK could be used in your environment. you can write your own front end to Web Query. some customers have requested the ability to build the power of Web Query into their own applications. we pass information from our display file into a query.net. Using the SDK. The SDK can come in handy here.

com/systems/i/db2/webquery 16.runs linked data returned. For complete details. They also need the RunTime User Enablement Feature (5733QU2 Option 4) to allow for unlimited runtime users. Below you will find a quick overview of each of the APIs.1 Core APIs The following list are the core APIs: WebQueryLogOn . such as a graph WebQueryDrill .provides login and security checking WebQueryRunFex .3 Requirements To use the SDK for development work. To summarize.lists possible values for a field.runs a report or graph WebQueryFexReflection . can be useful in conjunction with WebQueryFexReflection for building user interfaces MREGetUserDomains .Optional .provides a list of required parameters for a report WebQueryLink .4. They would also need at least one copy of the Developer Workbench product. There are eight core web services and four additional ones specific to Report Broker. DB2 Web Query SDK (5733QU4) To run an application developed with the SDK you need: DB2 Web Query R111 or higher (5733QU2 *BASE) RunTime User Enablement (5733QU2 Option 4) DB2 Web Query Report Broker (5733QU3) . 16. To use an application written in the SDK.only needed if the application will invoke the Report Broker Features. 2010 1:16 pm 7214chSDK.ibm.Optional .only needed if the application will invoke the Report Broker Features.returns a list of domains a user is authorized to MREOpenDomain . Assuming the developers of the code would like to test it. the purchaser would need the base product at level R111 or higher.passes a drill-down value into a report WebQueryFieldValues . please see the DB2 Web Query SDK Manual available from the DB2 Web Query home page located at: http://www. the end user system would require a system with the base product at level R111 or higher. Software Development Kit 419 .fm 16. developers will also need the RunTime User Enablement feature.4 Web Services The SDK is implemented via a set of Web Services. to Develop using the SDK you need: DB2 Web Query R111 or higher (5733QU2 *BASE) Developer Workbench (5733QU2 option 3) RunTime User Enablement (5733QU2 Option 4) DB2 Web Query Report Broker (5733QU3) .Draft Document for Review January 3.opens a domain to get the list of items in it Chapter 16.

we need to use the WebQueryLink function to actually return the image to the user. Next. They would select that item from the MREOpenDomain return. we could skip this last step as the report would come back as part of the WebQueryRunFex.fm Draft Document for Review January 3.7214chSDK. here is a quick explanation of the code path your application would take.2 Report Broker APIs The following are the report Broker APIs: logon .net application that uses most of the functions described above. After the domain is picked. 2010 1:16 pm 16. that info would be used for MREOpenDomain to get the list of folders and reports in that domain. 16.4. We would then call WebQueryFieldValues to get the list of possible valid values for that parameter and ask the user to pick.4. First. WebQueryLogOn would be called to verify this information. The user interface shows the various options discussed in the previous section. 420 Getting Started with DB2 Web Query for i .runs an existing schedule entity 16. we are including three sample screen shots below.logon to the Report Broker server getSchedule .4 Samples To help illustrate how the SDK can be used. we would use WebQueryRunFex to actually create the graph.3 Sample code path To provide a quick overview of how your application would use the APIs. Let's assume one exists.returns info about an existing schedule entity getScheduleInfoListByCaller . Once we know the graph and have the parameters.returns a list of scheduled entities owned by the id logged in run . Since it is a graph coming back.4. MREGetUserDomains would get the list of domains for that user and the user would be asked to select one. Let's assume the user wants to run a graph. the user would asked for their user profile and password. The application would call WebQueryFexReflection to get a list of any parameters required for that graph. The first is of a VB. If it were a report.

fm Figure 16-1 PC VB.net application sample The second is of the enhanced SugarCRM screen as shown in Figure 16-2 on page 422. 2010 1:16 pm 7214chSDK.Draft Document for Review January 3. Chapter 16. Software Development Kit 421 .

2010 1:16 pm Figure 16-2 Web-based SugarCRM application sample Finally. the example screen shot provided in Figure 16-3 shows an RPG based application enhanced to use the SDK.2.7214chSDK. “Uses of the Web Query SDK” on page 418.fm Draft Document for Review January 3. 422 Getting Started with DB2 Web Query for i . These last two items are some of the possible ideas discussed in 16.

2010 1:16 pm 7214chSDK. Software Development Kit 423 .Leveraging DB2 Web Query web services from IBM i applications“ which can be downloaded from the following URL: http://ibm. Included in this paper is a reusable PHP application that may be used as a starting point for PHP application providers to integrate DB2 Web Query web services into their web applications.Draft Document for Review January 3.com/partnerworld/wps/whitepaper/i/php_db2/webquery This white paper explores the usage of the DB2 Web Query for i Software Development Kit (SDK) with PHP applications running on IBM i.fm Figure 16-3 RPG based application sample For a detailed discussion on using the SDK to integrate DB2 Web Query content into a PHP application see the white paper titled “DB2 Web Query Integration from PHP . Chapter 16.

2010 1:16 pm 424 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3.7214chSDK.

2010 1:16 pm 7214p05. “Performance considerations” on page 435 Chapter 19.fm Part 5 Part 5 Miscellaneous or additional topics This part includes the following chapters: Chapter 17. “Using DB2 Web Query to run existing Query/400 reports” on page 427 Chapter 18. 425 . “Frequently Asked Questions” on page 479 © Copyright IBM Corp.Draft Document for Review January 3. All rights reserved. 2009.

2010 1:16 pm 426 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3.7214p05.

Draft Document for Review January 3. we show how to create metadata from your QRYDFN objects so DB2 Web Query can run your existing queries. 2010 1:16 pm 7214ch11. We also discuss common uses for Query/400 and how DB2 Web Query can maintain that same functionality. we discuss the similarities and differences between Query/400 and DB2 Web Query. In addition. 427 . © Copyright IBM Corp. Using DB2 Web Query to run existing Query/400 reports In this chapter. 2009. All rights reserved.fm 17 Chapter 17.

it sends the output to a Database file. DB2 Web Query treats table and QRYDFN metadata in quite the same way. 17. you understand that DB2 Web Query is the intended replacement for Query/400. Then DB2 Web Query submits the actual RUNQRY command to the server and displays the results to your browser. This does not to imply that familiar commands such as WRKQRY and RUNQRY are going away. DB2 Web Query has a thread-safe command that allows all your reports developed in DB2 Web Query to be used in your batch jobs. when DB2 Web Query runs that report. Also since IBM development has not made recent changes to the Query/400 code. Database file output: If your QRYDFN object is defined with the output option of Database file. likewise the reverse is true.fm Draft Document for Review January 3. Right Join: WRKQRY does not support Right Join and neither does DB2 Web Query. technologies that have stood the test of time and are useful to your business. a basic user is unable to tell if the report that is running is based on a DB2 object or a QRYDFN object. but rather product Query/400 is going away. This is also true of QRYDFN objects. The eventual goal in some shops might be to completely replace their QRYDFN objects with DB2 Web Query reports. As discussed in Chapter 3. With this in mind. With the exception of what we discussed in Chapter 5. yet robust. Spooled file output: If your QRYDFN object is defined with the output option of Printer. DB2 Web Query sends the output to a spooled file. The process of creating metadata on QRYDFN objects is quite similar to the process for tables. Batch capabilities: It is common to submit a CL program to batch that performs several RUNQRY commands. we summarize how DB2 Web Query and Query/400 have the same functionality: Report appearance: Based solely on report appearance. Just as DB2 Web Query supports Query/400 functions. The information and appearance of both final reports based on QRY/400 metadata versus DB2 file metadata are identical. DB2 Web Query also performs the output option that is defined in the QRYDFN. “Report Assistant” on page 97. 428 Getting Started with DB2 Web Query for i .2 DB2 Web Query versus Query/400: Function similarities In the following list. Query/400 appeals to users because it is easy to learn and does not require programming skills or knowledge in SQL. the user interface has remained familiar and code defects are practically non-existent. DB2 Web Query can also perform this functionality. You only need to create metadata on the QRYDFN object like you do for a DB2 table. 2010 1:16 pm 17. DB2 Web Query has the ability to run your existing Query/400 reports without you changing or running a conversion process on the QRYDFN object. or database file. Just as RUNQRY has the three output options of display. DB2 Web Query requires special metadata to read from table objects.7214ch11.1 Query/400: A reliable reporting tool By now. all Report Assistant functions can be used on Query/400 metadata. Recall that DB2 Web Query sees the Query/400 result set much like a table. spool file. You can still use older. After the metadata is created. “DB2 Web Query fundamentals” on page 25. It is likely that Query/400 falls into this category and has been a reliable reporting tool that your users have become easily adept with.

the work files are deleted. Therefore. “Parameterized reports” on page 133. After you create the metadata. If you cannot change your work files to be in the QTEMP library. the work files are created again. Figure 17-1 QRYDFN with parameters As noted earlier in this chapter. you must change your QRYDFN object to not accept parameters. library QGPL is used to hold the work files. Then you create the metadata only once on the QGPL work files and create reports from the work files. This is done by using a variable in the selection clause. DB2 Web Query does not know that the underlying files have since been deleted and recreated. It is still possible to do this “chaining” in DB2 Web Query. If you change your work files from QTEMP to another library. Parameter passing It is possible to create a QRYDFN object that can accept parameters at run time. When the job is done. This limitation means that QRY/400 queries that were coded for use as STRQMQRY ALWQRYDFN(*YES) to allow parameter input must instead use the DB2 Web Query parameter passing. Then the QRYDFN object is called by using the STRQMQRY ALWQRYDFN (*YES) command.3 DB2 Web Query versus Query/400: Function differences In this section. Chapter 17. the intermediate file must be in a different library. However. then the metadata can be created. the previously created metadata successfully runs the report. you will be unable to do query chaining. Using output files for the next query It is common to use RUNQRY outfile results for use in the next RUNQRY. be mindful to change your program to delete the work files. In all cases. metadata remains valid even if the underlying object is deleted and recreated. You must run all the reports and generate the outfiles to QGPL. which prompts the user for parameters. it does not check the format-level identifier of the file as some programs do. if the underlying object is changed. The limitation of DB2 Web Query is that you cannot create metadata on any object in QTEMP. then the metadata is stale and must be recreated. As long as the files are created with the same fields and format as before.Draft Document for Review January 3. For example. DB2 Web Query sends the RUNQRY command to the server.1. you can use Report Assistant to code the parameters into the selection criteria. Figure 17-1 shows how this is used. the limitation is explainable and a workaround is provided. The next time the job runs. In summary. See 5. The metadata is hardcoded only with a library and file name. although you must first create metadata on the intermediate output files. Commonly the library QTEMP is used to store these intermediate work files. It does not send any version of STRQMQRY. Using DB2 Web Query to run existing Query/400 reports 429 . for creating a parameterized report. 2010 1:16 pm 7214ch11. we discuss the functionality that Query/400 has that DB2 Web Query does not have.4. First.fm 17. Do not delete the QGPL files.

it also requires metadata to read from Query/400. you must recreate the metadata on that QRYDFN. otherwise the metadata creation will not be complete. For this reason. you must remember to complete a few extra windows. This is because it is gathering information about the files and columns that were used in the query output. When creating metadata on QRYDFN objects. In this case. In the left pane of the Data Adapters page (Figure 17-2). we explain the process when creating Metadata for Query/400. The process of creating metadata on a Query/400 runs the query at that time. 1. In the following steps. You can choose to create metadata for all queries in a library in a single execution. 2010 1:16 pm 17. Figure 17-2 Selecting the data adapter 430 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. the processing of creating metadata on a Query/400 object can be somewhat longer than on a DB2 table. you must recreate the metadata on those files. if you change the format of your underlying files. If you change the QRYDFN on the server side. click the Query iSeries adapter and select Create Synonym. select the adapter to use. DB2 Web Query asks for the library name where your Query/400 objects are stored. There are two additional windows for creating metadata on a Query/400 object versus on a DB2 object.7214ch11. Remember to click the Next button until you no longer see one. As noted earlier.4 Creating metadata from Query/400 objects Just as DB2 Web Query requires metadata to read from DB2 files.

Therefore. b. Chapter 17. If you previously created a synonym on this object and want to replace it. By selecting this option. In the Select Synonym candidates for Query iSeries pane (Figure 17-4). Select the Query/400 object on which you want to create metadata. Using DB2 Web Query to run existing Query/400 reports 431 . Click OK to indicate that you want to continue. every QRYDFN in the entire library is selected. Click Submit.Draft Document for Review January 3.fm 2. Figure 17-3 Creating a synonym 3. we enter the RMMASON library. this is the first time for creating metadata on QRYDFN in this library. we select Default synonym name. complete these steps: a. You see a warning message like the one in Figure 17-5. Figure 17-4 List of QRYDFN objects d. 2010 1:16 pm 7214ch11. In this case. which says that the synonym creation process can take a long time. c. select Overwrite existing synonym. In this case. In the Query Synonym for Query iSeries pane (Figure 17-3). enter the library where the QRYDFN object resides.

DB2 Web Query creates a report from your QRYDFN. This is the last pane on which you must click Next. Click Create Synonym. In the Create Synonym for Query iSeries pane (Figure 17-6). you see a status of “Create successfully”.7214ch11. Figure 17-6 Created successfully status message 5.fm Draft Document for Review January 3. In the Create Synonym for Query/400 File: Save Reports pane (Figure 17-7). 2010 1:16 pm Figure 17-5 Warning message . 4. if synonyms creation was successful.Creation Synonym for Query/400 432 Getting Started with DB2 Web Query for i . notice the Report Name column.Creation of synonyms e. Figure 17-7 Final confirmation window . Click Next. Click Next.

You might want to add a prefix or suffix that can help you to identify that the object being queried on the server side is a QRYDFN. you can add a new join with DB2 Web Query. Currently bad data is returned and might change into an error message instead. but you can only work within that result set. those changes are not reflected in the QRYDFN object.Draft Document for Review January 3. and filter the report. In the Create Synonym for Query/400 File: Save Reports Status pane (Figure 17-8). 2010 1:16 pm 7214ch11. sees the Query/400 result set as any other table. “DB2 Web Query fundamentals” on page 25.Conversion from Query/400 to DB2 Web Query Now if you go back into your DB2 Web Query domain. in Chapter 5.fm 6. When editing a Query/400 report that contains a join. If you edit the report from DB2 Web Query. However.5 Using DB2 Web Query to edit a QRYDFN After you create metadata. Since compute is data manipulation done on the client side. in effect. sort. notice that the status indicates “Created successfully” for the Query/400 metadata creation. Chapter 17. you will be unable to tell if the underlying object is a DB2 table or a QRYDFN. However the define operation is data manipulation performed on the server side. Keep in mind that after metadata creation. Figure 17-8 Created successfully message . You can click this report to run it or right-click it for the editing options. You cannot add new columns to the report. DB2 Web Query understands the metadata as a result set. Using DB2 Web Query to run existing Query/400 reports 433 . notice that the metadata is already created as a report. you can still use compute on your Query/400 reports. Close this window. 17. you will be unable to edit the joins already defined in Query/400. Therefore. Options when creating metadata: Prefix and suffix The guidelines for adding a prefix and suffix to metadata are the same as outlined in Chapter 3. “Report Assistant” on page 97. even if the column is from a table that is used in the report. you are unable to do this when editing a Query/400 object. You can use DB2 Web Query to edit. For example. we learn the difference between compute and define. DB2 Web Query.

fm Draft Document for Review January 3.7214ch11. 2010 1:16 pm 434 Getting Started with DB2 Web Query for i .

435 . In this chapter. 2010 1:16 pm 7214ch12.fm 18 Chapter 18.Draft Document for Review January 3. we discuss DB2 Web Query performance considerations and recommendations. © Copyright IBM Corp. We include a case study that is intended to demonstrate steps that you can take to tune a DB2 Web Query report. Performance considerations Minimizing the processing time for report requests and maintaining the accuracy and integrity of the report data are major goals for most organizations. All rights reserved. 2009.

it maintains various forms of statistics about the data. decision making. Those adapters use different methods to access the data. the database engine should be preferred over DB2 Web Query. Therefore. In addition. This can have the following results: Higher processing costs for both the database engine and DB2 Web Query Potentially higher network communication costs since larger-than-necessary result sets are moved around the network Higher personnel costs since time is wasted waiting for inefficient queries to execute and return the requested data 18. we discuss performance considerations that are specific to the DB2 call-level interface (CLI) adapter. Its optimizer component uses complex costing algorithms to determine the ideal access plan. the SQL statement is submitted to the database engine for processing. keep in mind the following DB2 Web Query characteristics regarding how it approaches performance optimization: When a DB2 Web Query report is run.2. For accomplishing all processing tasks in an efficient manner. the DB2 for i database engine knows its own data. To aid in its decision making processes. the database engine retrieves all the rows that are necessary for the request based on the translation.7214ch12. you must first understand the overall process flow when reporting from relational data. Like most other relational databases management systems (RDBMS). When the report is run. and aggregating must be performed. much of the database code lies below the Machine Interface (MI) layer of i5/OS. the tasks of row selection. the DB2 Web Query reporting server. ordering. and execution as possible down to the database level. which indexes to use. so that it can retrieve the data in the most efficient manner. DB2 Web Query then completes that processing necessary to prepare the data for the report.2 DB2 CLI adapter performance In this section. the goal of DB2 Web Query optimization is to push as much of this processing. sorting. Attention: SQL translation does not occur for reports that go through the Query/400 or DB Heritage Files adapter. the DB2 Web Query reporting server performs the tasks such as joining.fm Draft Document for Review January 3.1 Report request process flow As a foundation for understanding DB2 Web Query performance factors. joining. which is an attribute that can yield great efficiencies during the query optimization and execution steps. and so on. It is important to comprehend this process flow so that you can see where their different phases of optimization occur when a report request is made and how you can influence them. In these cases.1 Performance basics When the objective is to obtain optimal report performance. 2010 1:16 pm 18. 18. or a combination of both. DB2 Web Query attempts to translate the source code of a DB2 Web Query report into equivalent SQL statements. 436 Getting Started with DB2 Web Query for i . and aggregating. If a request is not optimized. These tasks can be carried out by the DB2 for i database engine.

so that the Reporting Server can create metadata for the result set that will be returned d. and which connection to use Chapter 18. Performance considerations 437 . Parses the procedure (checks the syntax of the source code) c. The Web server or application server routes the request to the DB2 Web Query Reporting Server. Analyzes the DB2 Web Query access file for the specific table to access. Reads and parses the DB2 Web Query metadata b. 2010 1:16 pm 7214ch12. Analyzes the DB2 Web Query master file for the specific SQL module and dialect to use. and to retrieve the SQL column names b. Execution phase HTTP Clients Web Server/ Application Server Web Query Reporting Server DB2 for i5/OS Database result set Report production phase Report Web Query result set Figure 18-1 Flow of DB2 Web Query report run request Report execution phase The following steps occur during the execution phase of a report request: 1. Passes the procedure to the data adapter for processing 4. 3. The Web browser client sends the request to the Web server or application server for processing.fm The process of running a DB2 Web Query request consists of two phases: The execution phase The report production phase Figure 18-1illustrates the flow of the request through these two phases. Sends a DESCRIBE request to DB2 for i.Draft Document for Review January 3. 2. The DB2 Web Query data adapter component handles the following tasks during this phase: a. The Reporting Server component handles the following tasks during this phase: a.

The report Execution phase ends. Adobe or Excel). 438 Getting Started with DB2 Web Query for i . If all the commands in a DB2 Web Query report request are translated into the equivalent operation in SQL. Analyzes and optimizes the SQL statement or statements Chooses the appropriate access path and retrieval method Retrieves the data Creates the database result set 6. and so on that were not translated by the database engine). The database engine component handles the following tasks during this phase: a. DEFINEs.2. Processes the DB2 Web Query result set. the database engine component sends a row and an SQL status code to the Reporting Server. 7. c. 4. Report production phase At the completion of the report execution phase. Translates (optimizes) the DB2 Web Query request to the appropriate SQL statement or statements d. 2. Passes the SELECT statement or statements to the DB2 for i database engine 5.fm Draft Document for Review January 3. The Reporting Server component handles the following tasks during this phase: 1. the request is considered (from a DB2 Web Query perspective) to be totally optimized. b.7214ch12. then all joining. Asks the database engine for the next row (FETCH). Repeats tasks 1 – 4 (loop) until the end of the database result set (SQL status code +100). and formats the report output as requested by the instructions in the procedure. Puts the valid row into the DB2 Web Query result set. sorting or aggregating functions are handled by the database engine. Note: The database engine is now interfacing with the database result set and not the native relational data on DB2 for i. Converts nonstandard data into DB2 Web Query format. Reads the row from the database result set and processes any remaining actions on that row (IF/WHERE. Adapter optimization is the degree to which a DB2 Web Query request is translated to pure SQL statements to be handled by the database engine. When this occurs. making it available to DB2 Web Query. Displays the report via a browser or native program based on the type of output produced (for example. During the report production phase. 3. 18. 5. d. the report production phase begins. 2010 1:16 pm c. the data adapter attempts to translate the source code of a DB2 Web Query procedure into equivalent SQL statements.2 Adapter processing and optimization When reporting from relational data sources. applies style sheets. Maximizing the adapter optimization should be a major goal of any DB2 Web Query application. 6.

MAX Retrieve specific rows WHERE Ordering rows ORDER BY Retrieve specific aggregated rows HAVING Creating logical table structures (joins) FROM..fm Table 18-1 displays the DB2 Web Query operations and the SQL equivalent.WHERE. Table 18-1 DB2 Web Query operations and SQL equivalent Operation Retrieve rows for columns specified SQL equivalent SELECT SELECT DISTINCT(…. AVG. 2010 1:16 pm 7214ch12.Draft Document for Review January 3. Chapter 18. Performance considerations 439 . COUNT.... MIN.) Identify the table from which to report FROM Simple aggregation functions SUM.

NE. they can be used as part of a define-based join. +. ' | FIRSTNAME. OR. GT. Each is discussed in this section. /. 0.2 = ((CURR_SAL + OTIME_SAL) x 1. In some circumstances. the DEFINE expression must be an arithmetic or character string valued (COUNT) expression. Selection is translated to various predicates of the SQL WHERE clause except those expressions listed in Table 18-2. SQL translatable conditions Real-field operands of numeric data types (I. D. on the right side of the equal sign) in the DEFINE expression. Non-translatable DATE fields Spanned DEFINE fields DATE fields with formats other than YMD or YYMD DEFINE fields that span more than one segment in a joined structure Table 18-3 lists the DEFINE expressions that can be translated to SQL. Table 18-3 DEFINE expressions that can be translated to SQL Expression Arithmetic expressions NEWSAL/D12. or false. 1.1) .7214ch12. not on the format of the field that is being defined. 2010 1:16 pm Selection and projection Two important processes that occur during the SQL translation step of the execution phase are selection and projection. LE) Logical operators (AND.100. -) Subtraction of one DATE field from another DEFINE-field operands satisfying any of the above Real-field operands of alphanumeric data types. P. Table 18-3 provides more information about the DEFINE field expressions that can be translated to SQL. or a logical expression. *. LT. NOT) Arithmetic or character string expression operands (above) DEFINE-field operands satisfying any of the above Character string expressions FORMAL_NAME/A36 = LAST_NAME | '. 440 Getting Started with DB2 Web Query for i .) SALES_FLAG/I1 = (DIV_CODE EQ 'SALES') OR (COMMISSION GT 0). Table 18-2 Selection disablers Selection disabler Non-translatable DEFINE fields Description Certain DEFINE expressions can be translated to SQL as part of aggregation or record selection operations. the DEFINE expression must be an arithmetic valued expression.fm Draft Document for Review January 3. Selection Selection is the process of retrieving the table rows that meet the request criteria. (TEXT field formats are not supported with DEFINE expressions) String constants String concatenation operators DEFINE-field operands satisfying any of the above Real-field operands of any DB2 Web Query-supported data type (including DATE fields) Constants with same data type as field(s) in the predicate Relational operators (EQ. For aggregation. QUOTA_CLUB/I1 = (SALES_FLAG) AND (UNITS_SOLD GT 100). GE. The following examples are of translatable DEFINE expressions: For selection. a character string valued expression. These expressions are based on what is built (for example. F) Numeric constants Arithmetic operators (**. Logical expressions (Expressions that are evaluated as true.

Projection Projection is the process of retrieving the table columns that meet the request criteria. a progressive optimization hierarchy affects the SQL that is being generated. Figure 18-2 shows the order of adapter optimization. Projection is translated to be objects of the SELECT statement as follows: – Columns referenced in PRINT. it might be because join optimization is failing. so does aggregation optimization. Therefore. Ordering rows (SORT) If the sort optimization fails. refer to “Defining and computing fields” on page 115. if you Chapter 18. Creation of logical table structures (JOIN) If the join optimization fails. so does the sort and aggregation optimization. Optimization hierarchy In addition to individual operations being optimized. Note: SELECT * is never generated by DB2 Web Query. which helps to improve performance. and report response time. efficiency. the adapter always tries to translate row selection (WHERE) and projection operations to their SQL equivalents. If your report’s ordering or aggregating is not being performed by the database engine and you are unable to determine why. – Columns used as objects in JOIN or DEFINE operations. Figure 18-2 DB2 Web Query adapter optimization order Translation to SQL: Regardless of the hierarchy in Figure 18-2.fieldname return all columns in the Master File only. Aggregating rows (SUM/COUNT) Aggregation optimization occurs only if the join and sort operations were optimized and aggregation was required. SUM or COUNT commands.fm For more information about creating DEFINE fields. This hierarchy is mentioned because it is important for you to know what to focus on first.Draft Document for Review January 3. – PRINT * and SEG. 2010 1:16 pm 7214ch12. Performance considerations 441 . It is important to understand the DB2 Web Query selection and projection operations because they are both processes that reduce the volume of data that is returned from the database.

FROM.. Due to their potential complexity. If the join is processed by the database engine. 7. 442 Getting Started with DB2 Web Query for i . The database engine retrieves the data from the tables specified in the select statement. because of the processing hierarchy. The columns in the request are applied. the SQL Query Engine also has referential integrity and constraint awareness. sorting and aggregation can still fail. this is especially true for join operations. if any. This means that the optimizer is capable of using the referential integrity conditions to rewrite the queries to eliminate unnecessary join combinations. Again.. This can result in significant performance gains for queries with complex joining and is another compelling reason to try to achieve full DB2 Web Query optimization. 3.. DB2 for i usually handles the join if all the DB2 Web Query commands (where possible) are translated to their SQL equivalent. The database engine merges the rows using its chosen join implementation 4. Screening conditions are applied. Table 18-4 illustrates the strengths of DB2 Web Query as well with the corresponding strengths of DB2 for i. 2. 6. your analysis should begin with join optimization.WHERE) Row and Column selection (SELECT…WHERE) Sorting (SELECT…ORDER BY) Aggregation (SELECT…GROUP BY) Referential integrity and constraint awareness: As of V5R3. However. the following steps occur: 1. The DB2 Web Query request is optimized and is translated to a single SQL select statement.. Any column function values or expressions are calculated. 5. Table 18-4 Quick guide to strengths of DB2 Web Query and DB2 for i DB2 Web Query strengths DB2 for i federated joins Complex calculations Sophisticated formatting Generate graphs DB2 for i strengths Joining on local tables (SELECT. Join optimization A join operation is a complex function that requires special attention in order to achieve good performance. One result set is produced.7214ch12. 2010 1:16 pm have a poorly performing report that is joining two or more tables.fm Draft Document for Review January 3. it must be stressed that the goal is to allow the database engine to perform as much of the optimization and processing as possible.

You must eliminate these conditions if you want full DB2 Web Query optimization to occur. The join must be unique over the entire set of target table joined columns. refer to “Optimization and avoiding the multiplicative effect” on page 443. there are several conditions that cause the adapter to disable the optimization of the join operation. On the Report options tab. Consequently. DB2 Web Query might choose to generate and run multiple SQL statements to compute the correct output for your report. Doing so instructs DB2 Web Query that it is safe to construct a single SQL statement with the appropriate join syntax and submit it to the database engine. Joining DB2 for i/OS tables on different systems. thereby improving performance.fm Conditions that prevent full DB2 Web Query optimization After a query request is submitted. there are cases in which DEFINE fields are not translated to SQL.Draft Document for Review January 3. when there is no unique join to the target table. As mentioned previously in “Selection and projection” on page 440. When this happens. DB2 Web Query can potentially reduce the number of SQL statements that are generated. DB2 Web Query can process the entire report in one underlying SQL query. As a result. For more information about the multiplicative effect. Optimization and avoiding the multiplicative effect DB2 Web Query allows developers who know that they have a unique join to the target table to configure their report with this knowledge. Performance considerations 443 . Note that no one column must be unique in the target table. These join disablers are shown in Table 18-5. or independent auxiliary storage pools (IASPs) is carried out by DB2 for DB2 Web Query and not the database engine. Note that choosing the Use SQL Engine Joins option. Joining tables based on DEFINE fields prevents the database engine from processing the join. An aggregation at any level other than the lowest level of the JOINed structure or a child table whose foreign key does not totally cover its primary key (causing the parent table rows to be duplicated). Chapter 18. it is important to select this option only when you are certain of the uniqueness of the underlying data. DEFINE fields that span more than one segment in a joined structure Multiplicative effect Federated joins When you create a join connection (via the join tab) between tables. the join is not translated either. partitions. 2010 1:16 pm 7214ch12. In some cases. In particular. can result in incorrect results in the report (due to the multiplicative effect described earlier). the developer can select the Use SQL Engine Joins check box as shown in Figure 18-3 on page 444. and that DEFINE field is used as a join field. when the joined in table (called the target table on the right of the join panel) is joined via a unique join. DB2 Web Query can reduce these multiple SQL statements to a single SQL statement thereby improving DB2 Web Query’s performance considerably. Table 18-5 Join disablers Join disabler DEFINE based JOINs (only if the DEFINE expression is not translatable) Description A DB2 Web Query define-based join allows joining a cross-reference file to a host file field that was created by a DEFINE statement. A unique join is one where given a row from the initial table or tables (called host tables on the left of the join panel) matches at most one row in the joined in target table (on the right tab).

you can use one of two verification methods: Database constraint verification If either a primary or unique database constraint is in place for a table against a specific column or combination of columns.||JoinColumnN) then 'Unique' else 'Not Unique' END FROM target_table If the state of the data is currently unique. then it is better to err on the side of caution and not select the Use database optimization check box. The database administrator can run queries similar to the following example to see if the current state of the data is unique: SELECT CASE WHEN count(*) = count(distinct JoinColumn1||JoinColumn2||.7214ch12. Manual verification Tables might have unique data without strict database constraint enforcement. If you are not sure if future states of the data will be unique over the join columns. the administrator must use their judgement and knowledge of the data to decide if future states of the data are also unique. 2010 1:16 pm Figure 18-3 Database optimization setting To determine whether it is safe to select the Use database optimization check box and avoid the multiplicative effect.fm Draft Document for Review January 3. 444 Getting Started with DB2 Web Query for i . it is safe to select the Use database optimization check box for that join... You can also verify that the data is unique by inspection or knowledge of the data. In such cases. the database guarantees data uniqueness based on that constraint.

join syntax. there are techniques that you can use to influence this behavior and improve report response time. This particular technique is used to tune a problem report in 18. Creating SQL views During DB2 Web Query report development. If this happens. rather than the table or tables from the database description list. and aggregation syntax specified. “Performance case study” on page 466. Next. DB2 Web Query performs the sorting. join.fm Sorting optimization If any of the conditions listed in Table 18-6 are true. you might encounter situations in which a report does not fully translate to an SQL statement. This instructs DB2 Web Query to use the view and push the selection. 2010 1:16 pm 7214ch12. and in your report definition. causing DB2 Web Query to re-sort for the display report.Draft Document for Review January 3. Chapter 18. and aggregation to the database engine. TOT. Table 18-7 Aggregation disablers Aggregation disablers DB2 Web Query managed join or sort DB2 Web Query managed row selection Non-direct SQL operators Aggregation on a non-translatable DEFINE Description See Table 18-5 on page 443 and Table 18-6. DB2 Web Query performs the aggregation. Aggregation optimization If any of the conditions listed in Table 18-7 are true. one technique to help move toward full DB2 Web Query optimization is to create an SQL view with all of the appropriate selection. Some WHERE clauses are not passed to the database engine. In addition. create the synonym for the view. that cannot be translated into SQL. Other ways to influence optimization The conditions that we discuss in the previous sections help dictate whether DB2 Web Query or the database engine performs the bulk of the report processing. The request contains direct operators.5. Performance considerations 445 . select that view. such as PCT. Aggregating on a DEFINE field that cannot directly translate to SQL.. Table 18-6 Sorting and aggregating disablers Sort disablers DB2 Web Query managed join Sort on a non-translatable DEFINE field Interface-managed join Description See Table 18-5 on page 443 Any request that contains a sort on a non-translatable DEFINE field SQL sorts the answer set by the table’s primary key.

They are implemented as non-keyed logical files. you do not even define a join in your report. and airline flight schedules.ibm. This is a feature that helps you solve more complex business requirements. or EXCEPT operators.fm Draft Document for Review January 3. This means that views. have no access paths and thus. Establishing and using foreign key relationships If you have foreign key relationships explicitly defined in i5/OS database. making it available to all users and all SQL interfaces Provide an database abstraction layer Provide security granularity When the views are in place. The resulting multi-table synonym describes all of this table’s foreign key relationships. organizational charts. conditional logic Provide fullselect support An SQL fullselect is the term for generating an SQL result set by combining multiple SELECT statements using the UNION. 2010 1:16 pm The advantages of using views are many. When defined. you can take advantage of a DB2 Web Query feature to include with the selected table’s synonym. Important: Views should not be confused with indexes.com/servers/eserver/iseries/db2/pdf/rcte_olap. Through the foreign key 446 Getting Started with DB2 Web Query for i . INTERSECT. Provide Common Table Expression (CTE) and recursive SQL support CTEs can be thought of as temporary views that exist only during the execution of an SQL statement. making it easier to comprehend and maintain. All columns from the related tables are displayed on the “Field Selection” tab and you simply select the columns that you want to include in the report. which is especially useful when querying data that is hierarchical in nature. such as bill of materials. This can greatly simplifying the process of creating reports with joins. In fact.” which you can download from the Web at: http://www-03. in this scenario. With SQL views. this is not an issue with views. you can control specific rows and columns that users (or groups of users) can access. no access path maintenance. refer to the article “V5R4 SQL Packs a Punch. This can be used to reduce the complexity of the view. For more information about recursive CTEs. Among the V5R4 enhancements for DB2 for i was the ability for a CTE to reference itself. unlike indexes. The following list gives an idea of what SQL views can do: Provide the ability to specify additional join types that are not supported by the DB2 Web Query product DB2 Web Query allows you to specify inner joins and left outer joins. the CTE can be referenced multiple times in the same view. you can define those and the following join types: – Right Outer – Left Exception – Right Exception Allow you specify CASE statements to handle more complex. Because both selection and projection can be specified on the views. you can restrict users from accessing tables directly and only allow access through the views.pdf Allow business logic to reside in the database layer. This feature provides the mechanism for recursive SQL.7214ch12. If you or your database administrator (DBA) are concerned about access path maintenance. every table related to the selected table by a foreign key.

Draft Document for Review January 3. DB2 Web Query has the ability to create metadata against an MQT. and not be forced to rely on the optimizer to select the MQT. expand the DB2 cli folder and click *LOCAL.fm relationships. To obtain this behavior.Specifying the collection Chapter 18. this can result in significant performance improvements for complex queries. It provides a mechanism for improving the response time of complex SQL queries. Select Create Synonym. right-click your reports folder and select Metadata. While it can be thought of as a summary table. Performance considerations 447 . populated. what sets an MQT apart from a regular summary table is the fact that the SQE optimizer is aware of it and its relationship to the query and base tables that were specified when it was created and populated. While it is usually the optimizer’s job to select and implement an MQT in the access plan of a query request. Because the MQT is already created. 3. from the left navigation pane. just like any other table on the system. it can be accessed directly. Creating materialized query tables Materialized query table (MQTs) provide another method of improving performance of your queries. In the Data Adapter browser window. 2. This means that the optimizer considers using the MQT in the access plan of subsequent similar queries if it determines that it is appropriate to do so. 2010 1:16 pm 7214ch12. and sorted. joined. Because of this. you must first create the metadata for the MQT: 1. along with the query’s definition. Click Next. specify the collection and select the MQTs check box. aggregated. In the Select Synonym Candidates for DB2 CLI (*LOCAL) pane (Figure 18-4). This means that you can create DB2 Web Query reports that access an MQT directly. From the DB2 Web Query home page. An MQT is a table that contains the results of a previously run query. Figure 18-4 Creating a synonym for MQT . It is important to understand that an MQT is a table (a physical file with an object type of *FILE) that resides in a library (schema) in the System i environment. The process of creating synonyms with foreign key relationships is discussed in “Referential Integrity” on page 56. DB2 Web Query is able to understand the join syntax that needs to be created and generates the appropriate SQL statement.

gives you the option to pull data for your reports in one of the following ways: Local: All the data resides on the local system Remote: All the data resides on one remote system or partition Cross system: Data is spread across the local system or one or more remote systems or partitions. which you can find on the Web at: http://www-304. 2010 1:16 pm 4. and report users. select the MQTs that are listed. before implementing MQTs. query developers.ibm.fm Draft Document for Review January 3. This means that as the base tables used to populate the MQT change. you must know that MQTs are not automatically maintained.com/jct09002c/partnerworld/wps/servlet/ContentHandler/ SROY-6UZ5E6 18. In the Create Synonym for DB2 cli pane (Figure 18-5). and no other external factors are negatively influencing query performance. you can expect your reports to perform reasonably well. Probably most important.2. This feature. which is available only for the DB2 CLI adapter. Again. if your report requires data that is dynamic and up-to-theminute. the data in the MQT does not also change. see the white paper Creating and using materialized query tables (MQT) in IBM DB2 for i.3 Remote database access considerations (including cross-system joining) One feature of the DB2 Web Query base product is the ability to access data on remote DB2 for i systems or partitions. This is can be acceptable for queries that report on data that is historical in nature. For more information about MQTs.7214ch12. If full DB2 Web Query optimization can be performed for Local and Remote database access. However.select MQT After the synonyms are created for the MQTs. the MQT must first be manually refreshed. and click the Create synonym button. Figure 18-5 Creating synonym for MQT . Therefore. While their potential performance efficiencies are appealing for DBAs. you can create reports against them as you would for any other table object on the system. this is because DB2 Web Query can generate one SQL statement and allow the DB2 for i database engine to process the request. you might come to the conclusion that an MQT is not the right fit. specify a prefix and suffix. If the data in your reports must be up to date. MQTs have several attributes and limitations that must be understood prior to implementation. 448 Getting Started with DB2 Web Query for i . you must be willing to accept some level of data latency.

DB2 Web Query generates a separate SQL statement for each connection and submits the statement to each connection. the join fan-out is greatly reduced. The local system fetches each row from the (local) ORDERS table result set and generates the appropriate local selection to return the matching row from the remote STORES table. if the dimension table STORES resides on another system and Report Assistant is used to create a nearly identical report (the only difference being a cross system join specification to STORES). DB2 Web Query generates a single SQL statement and submits it to DB2 for i. Performance considerations 449 ."State"."State" FOR FETCH ONLY Since one statement is generated and the database engine handles all the joining."State" FROM "CENTURY"/"STORES" T5 WHERE (T5. this can be a lengthy and time consuming process. but is still not nearly as fast as when all tables are on same system. Example 18-1 shows how the statement looks. and ordering. This results in a report that runs significantly faster. If both of the tables are on the local (or even remote) system."LineTotal") FROM CENTURY/ORDERS T1. grouping.T5."Country". one for each system. Local system Example 18-2 Local system SQL statement SELECT T1. SUM(T1."StoreCode" = ?) FOR FETCH ONLY Inefficiencies occur because the remote SQL statement is submitted multiple times on the remote system."StoreCode" = T1."LineTotal" FROM CENTURY/ORDERS T1 FOR FETCH ONLY Remote system Example 18-3 Remote system SQL statement SELECT T5."StoreCode") GROUP BY T2. 2010 1:16 pm 7214ch12."Country".T2. A fact table (ORDERS) has 32. Consider the following scenario. you can expect this report to run quite efficiently. In this scenario.T1."Country". If the report is modified to specify STORES (with only 116 rows) as the base table."StoreCode".283 rows and is joined to a dimension table (STORES) that has 116 rows."Country". Therefore.CENTURY/STORES T2 WHERE (T2.Draft Document for Review January 3. However. DB2 Web Query now creates two SQL statements.fm However. With this implementation. Example 18-1 Single SQL statement SELECT T2. you must be aware of the performance implications if the data is spread across two or more System i machines or partitions. The answer set from each of these multiple sources is then joined together by the Reporting Server. Depending on how the joins are specified. the report takes significantly longer before the results are displayed to the browser.T2.T2. we generally recommend that you avoid creating reports with cross-system joins when the tables have a substantial Chapter 18."State" ORDER BY T2.

After all tables are on one system. Edit the report source and add the following line: SQL DB2 SET JOINTYPE SORTMERGE Figure 18-6 shows an example of this setting specified in the report source. This adapter functions by running the Query/400 query during both the synonym creation process and report execution. This means that if you have an existing Query/400 object that does not perform well and takes several minutes to run to completion. However. if such an implementation is required. This setting impacts the number of FOR FETCH lines when one of the tables is remote. consider the following suggestions to enhance the report’s performance: Eliminate the report’s requirement of multiple connections by making local copies of the remote tables. After the synonym is created and you run the new DB2 Web Query report.fm Draft Document for Review January 3. you can again expect it to require at least the same amount of time to run. Determine which of the tables has the smallest number of rows (after applying local selection) and make that the base table of the report. This reduces the fan-out effect of the join. thereby reducing the number of rows that must be retrieved from the other (larger) tables. 450 Getting Started with DB2 Web Query for i . join optimization can be enabled and DB2 Web Query attempts to generate a single SQL statement. it requires just as much time (and perhaps more) to create the DB2 Web Query synonym. 2010 1:16 pm number of rows. it turns all of the tables into local internal tables and sort merges them.3 Query/400 adapter performance Another feature of DB2 Web Query is the ability to run most existing i5/OS Query/400 queries. This is done by using the Query/400 adapter that is provided with the base offering of 5733-QU2. Figure 18-6 SORTMERGE setting 18. In effect.7214ch12.

Therefore.fm Because the adapter is running the existing query. In the following list. to access and report against the data. if not all. However. and fields that are aggregated. which are more manual in nature. The complexities of retrieval and maintenance are often handled by high-level language (HLL) program written in RPG or COBOL.Draft Document for Review January 3. When the users have done everything that they possibly can in the efficiency spectrum to ensure that the report definitions are as good as they can be. the files are likely to have redundant data that is difficult to navigate. This approach works when such programs are the only interface to the data and can hide the complexity from users.4. The following DB2 for i factors can affect efficiency: Database design Query Engine used Indexes Available hardware Number of concurrent users 18. There are also factors within the i5/OS database itself that can affect efficiency. such as DB2 Web Query. Because of the complexity. Missing from CQE is the ability to create index advisories for joining. to learn about approaches for implementing an indexing strategy. problems and confusion are likely to result when you expose your database and allow other interfaces. these are the factors that can still influence the overall efficiency of the request.1 Database design Good performance starts with a good database design. 18. In most cases. If your database structure is flat in nature and not normalized. Programmers can find themselves constantly creating new copies of reports to satisfy a seemingly endless list ad hoc reporting requirements by the user.4. CQE provides index advisory information for query selection. programmers (and not users) are forced to develop the reports. and ordering. Analysis and tuning. we highlight the shortcomings of a poorly designed database: Complexity The application programs contain most. are required for these types of requests. the sole tuning knob ensures that the appropriate indexes are in place for the optimizer to use when creating the access plan for the query. Chapter 18. If your Query/400 reports are not performing to your satisfaction. grouping. Performance considerations 451 . Classic Query Engine (CQE) processes non-SQL database requests such as those from Query/400 queries. As we mentioned earlier in this chapter.4 DB2 for i optimization By now you should be convinced that getting DB2 Web Query to hand off as much of the processing as possible to the database engine is a key factor in achieving optimal report performance. Often the reports themselves are HLL programs that can be complex and difficult to maintain. 2010 1:16 pm 7214ch12. the data is difficult to query because it is hard to understand rules and relationships. you are limited in the tuning that can be done to make each of the DB2 Web Query processes perform better. and maintain.3. business rules and data relationships. Refer to 18. These types of factors are usually the responsibility of the DBA and not the users. a little knowledge of these factors and how they can affect efficiency enables a user to communicate effectively with the DBA. retrieve. however. “Indexes” on page 461. order by fields. make sure that the indexes exist over all join fields.

The default value in 6. ordering. 18. This value allows the SQE query optimizer to ignore any keyed logical files that contain select/omit criteria during optimization and process the query instead of rerouting execution to CQE.6. and expand. Programmatic selection. Query/400. and therefore. Table 18-8 SQE Inhibitors 5. DB2 for i actually employs two database engines. Both CQE and SQE are used to process database access requests.1 for the Ignore_Derived_Index QAQQINI parameter has been changed to *YES. there are still inhibitors that can prevent SQE processing for SQL requests.1. This QAQQINI parameter was first added back in V5R3 to allow the SQL Query Engine to be used in environments where SQL statements are referencing DB2 objects created with DDS.7214ch12.4. Enhancements that add new features and boost performance 452 Getting Started with DB2 Web Query for i . If this describes your current database design.1 SQE Inhibitors Sort sequences Non-SQL Interfaces (OPNQRYF. adapt. joining. QQQQRY API) Logical File reference on FROM Clause Select/Omit Logical Files defined on tables Important: While as of 6. which places limits on the number of repeating groups that can fit into a single record format.2 Query Engine used As described earlier in this publication. IBM did change the default value for the Ignore_Derived_Index QAQQINI parameter to enable more SQE usage. Although SQE is the engine designed for SQL access. Less optimal access methods Performance of these reports can suffer because of the database complexity. the default value for this parameter was *NO causing the SQE optimizer to reroute execution of any SQL request to the Classic Query Engine (CQE) anytime a derived logical file was encountered during the query optimization process. QQQQRY API) Logical File reference on FROM Clause Select/Omit Logical Files defined on tables User Defined Table Functions (UDTFs).1 Sort Sequences Non-SQL Interfaces (OPNQRYF. UPPER & LOWER functions Read Triggers ICU 2.fm Draft Document for Review January 3. and as such. The SQE inhibitors for each supported version of the operating system are listed in Table 18-8. and grouping are often implemented with a row-at-a-time coding techniques.1. Repeating groups must be squeezed into a single record. the report performance is not maximized. Query/400. the SQE optimizer is still unable to utilize Select/Omit logical files when building query plans. Your goal as a database administrator or DB2 Web Query administrator/developer should be to ensure that each DB2 Web Query request is processed by SQE. Record blocking and set-at-a-time processing are not used. you might want to consider investing in a robust data modeling tool that can help you implement a database design that is both functional and efficient. Prior to 6.4 SQE Inhibitors 6. 2010 1:16 pm Lacks flexibility The database is difficult to maintain. Why is this so important? Because SQE is IBM’s strategic optimizer. it will be the one that the IBM development team focuses on.

html Use the DB2 CLI adapter whenever possible! – Keep in mind that both the Heritage File and Query/400 adapters use CQE – Recreate Query/400 reports as new reports that use synonyms based on DB2 CLI adapter – No way to avoid it for multi-format files (must use Heritage File adapter) – Use SQL Aliases to access multiple members Determining which engine is used You can also work in a reactive mode to determine which engine is handling your query requests.1because the default behavior is for SQE to ignore Select-Omit logical files. This process is documented in the tech tip Maximize SQL Query Engine (SQE) Usage of Your DB2 Web Query Reports which can be access from the following URL: http://www. or MQTs. and not CQE. you capture the SQL statement that DB2 Web Query is producing for a report and copy/paste the statement into the Run SQL Scripts Window of System i Chapter 18. Among them are the following: Materialized Query Tables (MQT’s) Maintained Temporary Indexes (MTI’s) SQE plan cache Ability to cache results Achieving SQE processing for every DB2 Web Query request is quite simple: avoid SQE Inhibitors! What could be easier? All kidding aside. Consequently. Performance considerations 453 . and you need to create metadata over a physical file that has Select-Omit logical files against it.fm will only be applied to SQE.4 of the IBM i operating system.com/database/db2/maximize-sql-query-engine-sqe-usage-o f-your-db2-web-query-reports. run the query.mcpressonline. and more efficient optimizer Self learning query optimization Ability to self-adjust during query execution Better/faster database primitives to access the data In addition. But if you are at 5. you will can instruct the optimizer to ignore this derived logical file by using the IGNORE_DERIVED_INDEX parameter in the QAQQINI query options file. Some of the reasons for this include: Enhanced optimization techniques – a smarter. create an SQL View that performs the equivalent filtering/joining Watch out for Select-Omit logical files against physical files Again.Draft Document for Review January 3. when a query is processed by SQE you can expect vastly superior performance over the same query handled by CQE. SQE provides many more features than CQE. faster. and use the System i Navigator dashboard to analyze results Using Run SQL Scripts window and Visual Explain With this method. 2010 1:16 pm 7214ch12. SQL views. the following list provides the major things to look out for in a proactive mode: Avoid creating metadata for DDS logical files – Only create metadata over tables/physical files. this is not as important in 6. Two of the most common ways to do this are as follows: Run the statement in Run SQL Scripts window (System i Navigator) and use Visual Explain to analyze the results Start a database monitor collection. – If you need the filtering or joining provided by a DDS Logical File. This can be done by collecting a database monitor and analyzing the results.

this option displays the generated SQL statement. as well as a wealth of information about the plan. Visual Explain is then launched against the statement to produce a graphical representation of the optimizer’s chosen access plan for the query. Right-mouse click on the report and select Run w/SQL Trace Figure 18-7 Rather than running the report and displaying the results. 4. Paste the statement from your clipboard into the Run SQL Scripts window. 454 Getting Started with DB2 Web Query for i . Part of the information provided in this process is which query engine is used.7214ch12. take the following steps: 1. This is shown in Figure 18-9 on page 455. 2. To implement this method.fm Draft Document for Review January 3. In System i Navigator open a connection to your system and launch a Run SQL Scripts window. copy this statement to your clipboard Figure 18-8 Copy the SQL statement 3. 2010 1:16 pm Navigator. As shown in Figure 18-8.

’ for all qualified object references.fm Figure 18-9 Paste the SQL statement Tip: Depending on your configured naming convention (*SQL or *SYSTEM in the format tab of the JDBC settings for your System i Navigator connection). As shown in Figure 18-10. This means that you may have to the replace the ‘/’ character with a ‘. Performance considerations 455 . 5.) between the library and object names.Draft Document for Review January 3. The naming conventions are: *SQL naming convention uses a period (. *SYS naming convention uses a forward slash (/) between the library and object names. you may have to edit the statement after you paste it into the window. swipe/highlight the statement and click the Explain icon in the tool bar. 2010 1:16 pm 7214ch12. Figure 18-10 Explain the SQL statement Chapter 18.

This is shown in Figure 18-11.7214ch12. In this case. 456 Getting Started with DB2 Web Query for i . Using database monitor collection Another technique is to run the report in DB2 Web Query after starting a an SQL monitor. Right click on SQL Performance Monitors and select New → SQL Performance Monitor as shown in Figure 18-12 on page 457. It also renders a graphical representation of the query access plan. 6. You can then use the dashboard provided with the On Demand Performance Center tool to quickly determine which query engine is used. The value of this attribute provides the information you are looking for. Figure 18-11 Visual Explain example The Query Engine Used attribute appears at the bottom. The following steps describe this process: 1. Open a System i Navigator connection to your system and expand Databases → <name_of_your_database> 2. 2010 1:16 pm This action launches the Visual Explain utility.fm Draft Document for Review January 3. SQE was used. Visual Explain provides information about the optimizer’s chosen access plan. Select the “Final Select” icon on the plan and scroll down to the bottom of the Attribute pane on the right.

Performance considerations 457 . This window allows you to specify pre-filtering criteria for the monitor collection. An example screen is provided in Figure 18-13. On the SQL Performance Monitor Wizard dialog window. specify the following: – Name: DB2 Web Query Redbook monitor – Type: Detailed – Schema for data: QGPL Click the Next button.Draft Document for Review January 3.fm Figure 18-12 Start new SQL Performance Monitor 3. 2010 1:16 pm 7214ch12. Using pre-filtering is strongly recommended because it can greatly reduce the amount of monitor Chapter 18. Figure 18-13 SQL Performance Monitor Wizard window 1 The second dialog window for SQL Performance Monitor Wizard is presented.

ideally to a single SQL statement. 2010 1:16 pm data collected.7214ch12. This should keep the collection small .fm Draft Document for Review January 3. select the radio button for All jobs and click the Next button. 4. 458 Getting Started with DB2 Web Query for i . enter QWQCENT Figure 18-14 SQL Performance Monitor Wizard window 2 5. click the Finish button. As shown in Figure 18-14. In this example. you pre-filter on the user profile running the request and the schema (library) name of the object being queried. specify the following prefilter criteria and click the Next button: – Check the box for Current user and specify your user profile name – Check the box for the setting Statements that access these objects: and under Schema. On the third dialog window for SQL Performance Monitor Wizard. This will help keep your analysis simple. An example is displayed in Figure 18-15. Figure 18-15 SQL Performance Monitor Wizard window 3 On the final dialog window for SQL Performance Monitor Wizard.

Chapter 18. Figure 18-17 End SQL Performance Monitor 9. Again. Find the monitor you just started and select End from the right-click menu (Figure 18-17).fm Figure 18-16 SQL Performance Monitor Wizard window 4 6. This time select the Analyze option as shown in Figure 18-18 on page 460.Draft Document for Review January 3. Return to the System i Navigator session. The monitor can now be ended. 2010 1:16 pm 7214ch12. At this point the monitor data has been collected for the report run. Under the connection. 8. select Databases → <name_of_your_database>SQL Performance Monitors A list of available SQL Performance monitors are displayed. 7. Performance considerations 459 . Now you can analyze the results. Return to your DB2 Web Query browser session and run the report. right-click on the monitor entry.

Figure 18-19 SQL Performance Data Analysis dashboard 460 Getting Started with DB2 Web Query for i . As displayed in Figure 18-19 the dashboard shows the value of 1 for SQE and 0 for CQE.fm Draft Document for Review January 3.7214ch12. This means your query was processed by SQE. find the lines for SQE and CQE. 2010 1:16 pm Figure 18-18 Analyze SQL Performance Monitor The SQL Performance Data Analysis dashboard window is launched. Under the Overview category.

Draft Document for Review January 3. at this point. Performance considerations 461 . It makes a recommendation that the Chapter 18. In some cases. every row in the database table must be read. When your database is in production. 2010 1:16 pm 7214ch12. However. You can download this paper from the Web at the following address: http://www. Indexes add overhead to a database. Indexing strategies is a broad topic that is covered in detail in the white paper Indexing and Statistics Strategies for DB2 for i. ordering. Such useful information provided to the optimizer results in a better access plan and a better performing query.fm 18. Indexes must be maintained by the database whenever the data in the underlying table changes. such as the average number of duplicate values and column cardinality of the tables being queried.ibm.4. the following tips can help you get started: Take a proactive approach and make sure there are indexes available over all of the selection. requests might only need to use the index. Sometimes DBAs are reluctant to add indexes for reporting application efficiency if the database is one that is not dedicated to reporting purposes. Using indexes might result in the following ramifications: As mentioned previously. joining. it might be difficult to implement recommended database design practices such as database normalization.html?indxng In addition. the database engine provides index advice during the optimization phase. Ensure uniqueness A unique index on a column ensures that no duplicate values exist for that column. you can still implement an indexing strategy that helps to optimize the performance of your query reports. Improve efficiencies The optimizer can choose to use the index during implementation. run your queries and use the available database feedback mechanisms to determine what indexes the optimizer wants created. This occurs when it determines that a useful index does not exist against the table or tables that are being queried. Even secondary indexes can be used in the case of data selection statements. When a query is executed. never accessing the actual data (a condition referred to as Index Only Access). indexes can speed data retrieval. thus avoiding more costly implementation alternatives such as table scans or creation of temporary structures.3 Indexes Like any other application that accesses information from the database. This is because they provide relevant statistics and information. Indexes over your database tables have the following advantages: Provide statistics to the optimizer Indexes against the queried tables give the optimizer a better opportunity to select the most efficient access method.com/servers/enable/site/education/ibo/record. and grouping columns of your queries. efficient DB2 Web Query performance heavily depends on having the right indexes in place. In a reactive mode. If a table scan is performed. this an be a lengthy process and can consume a significant share of system resources. Depending on the size of the tables and the complexity of the query.

This information is used to help the optimizer cost each access method. While DB2 Web Query can run on any system with V5R4 or higher. 18. For more information about SQL and database performance analysis. less memory. it is also important that you have a balanced hardware configuration. This is because when it comes to driving workloads. twelve years old. What does this mean? It means that simply adding more memory or another processor to your system may not improve overall performance and create an unbalance in the environment.4 Available hardware Hardware is certainly a critical component when considering the factors that can impact an application’s performance. To help illustrate this. Afterward. 3020 record SQL Performance Monitor. A balanced system While sufficient hardware resources to run your workloads is critical factor.4. the ultimate goal is to keep the processor busy while minimizing wait times (queueing). newer models do offer the advantages of more processing power and better overall throughput. this advice can be obtained from various sources. and overall inferior throughput. two technologies that will consume system resources.7214ch12. 3020 record Visual Explain The index advisories can be extracted from these sources of optimizer feedback and used to create the recommended indexes. 2010 1:16 pm index be created. Typically older hardware equates to less resources: slower processors. refer to OnDemand SQL Performance Analysis Simplified on DB2 for i5/OS in V5R4.the processor The sink .fm Draft Document for Review January 3. Indexes are sometimes advised for the information they can provided to the optimizer. including the following sources: – – – – – Index Advisor SQE Plan Cache SQL Plan Cache snapshot. consider the following dish washing analogy: Lets say you own a restaurant and one of the workloads to be performed is washing dishes. It might also help the optimizer determine that the advised index is not the optimal one to use during query execution. you need to evaluate your performance expectations and decide if you want to run modern software on a server that is. you might observe that the optimizer does not use that index during implementation. SG24-7326. The bottom line is that factors such CPW ratings and amount of available memory do matter when it comes to DB2 Web Query performance. The product makes heavy use of JAVA and SQL.memory The bussers . Insufficient resources usually mean users sit and wait while the work is being done. If its been awhile since your last upgrade. for example.disk units/arms 462 Getting Started with DB2 Web Query for i . Important: When an advised index is created and the query is run again. In this “subsystem” the busser (term used for both busboy and busgirl) brings the dirty dishes and places them in the sink and the dishwasher (a person) takes the dishes out of the sink and washes them. Each component in this process can be analogous to a component in your hardware configuration: The dishwasher . This is true of any application running on the system.

you hire four additional bussers. This corrective action helps and Frank becomes busier but is still waiting for work. Workload estimator for DB2 Web Query Determining the system resources needed to run your query workloads while maintaining a balanced system. The number of bussers is optimal as is the size of the sink. You observe that there are 4 bussers (working frantically) and they cannot bring dishes into the sink fast enough (queueing at the disk I/O level is occurring). you purchase a bigger sink (more memory). To help you with this venture. Evaluating the situation. You finally have a balanced system that meets your performance expectations. You walk into the kitchen and discover that Frank. This eliminates the queuing at the sink and Frank stays busy all the time. This means that queueing is occurring earlier in the process. You now have a balanced system. 3. To access the DB2 Web Query WLE. You then observe that many more dishes can be placed in the sink. Showcasing your sharp business acumen. IBM has provided a Work Load Estimator (WLE) for DB2 Web Query. 4. At this point the system is again out of balance. performance expectations. It is based on a series of workload benchmarks defined and performed by the IBM STG Lab Services team.ibm. you ascertain that hiring more bussers will not help. This simple analogy is meant to illuminate the fact that the amount of work to be done. open a web browser and specify the following URL: http://www.” So you trade in that sink for one that is even larger. 2. the dishwasher is waiting for work. Therefore. You conclude that there are two choices: you can either fire Frank and hire a faster dishwasher (upgrade) or you can hire another one to help Frank out (add another processor). again. Frank is a good guy and has never called in sick once in the three years he has been employed. 5. This tool is a sizing guide that is provided to help you estimate your hardware resource needs for DB2 Web Query workloads and is part of IBM’s suite of sizings guides.com/servers/sizing Once on this site. but you are still not satisfied with the pace of which the dishes are being washed. acceptable performance and a balanced system are largely dependent on the following: The speed of the dishwasher The number of dishes to be washed Performance expectations Let’s say the process is not going as fast as you would like and not enough dishes are being cleaned. but it does not help overall performance whatsoever. waiting to place dishes in the sink because the sink is full (not enough memory). Performance considerations 463 . So you take the following steps: 1. 2010 1:16 pm 7214ch12. is not a trivial task.fm The goal is to keep the dishwasher busy (as long as there is work to be done) so that the dishes are cleaned as fast as possible. So you hire four more bussers. This new hire proves to be the right move: Frank and Gus become a formidable dishwashing duo. This is an example of an unbalanced system. thus here is no queueing. and a balanced system must be considered when it comes to evaluating your hardware resource needs. Your performance expectations are not being met. Chapter 18.Draft Document for Review January 3. And an even bigger sink would a foolish purchase. so you decide to help him out and hire his third cousin Gus. This is because the dishes are piled up in a big heap in the sink and poor Frank can not work any faster (too much memory). producing clean plates at a brisk and more than acceptable pace. “What the heck. specify DB2 Web Query as the search refinement text string as shown in Figure 18-20 on page 464.” you think to yourself “it worked before. So. This has no effect on performance because now the bussers are queued up.

a data warehouse) Once you have completed these steps. medium. the sizing guide will provide an estimate of the minimum hardware configuration necessary to run the defined DB2 Web Query workloads Note: Although DB2 Web Query does not require Power6 hardware. light). This include factors such as the size of your database 3. Environment Attributes about the environment the DB2 Web Query product will be running in. 2. 2010 1:16 pm Figure 18-20 Search sizing guides Once you are into the DB2 Web Query WLE. Users Includes the number of concurrent users and developers and the types of users (heavy. if applicable. 464 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. against production databases) or a dedicated Environment (for example. the DB2 Web Query WLE produces Power6 hardware recommendations only Figure 18-21 on page 465 provides an example of the output produced by the DB2 Web Query WLE. Specify whether queries are running in a shared Environment (for example.7214ch12. Information such as the following should be included: 1. you define the workload characteristics to the tool. Specifics of production environment.

application users typically equate to more workload on the system. 18. as the word spreads and your restaurant gains popularity. 2010 1:16 pm 7214ch12. Actual customer results may differ significantly. You may have a balanced system with satisfactory performance. your will either experience queuing or a processor that cannot keep up. and user options. More customer means more dirty Chapter 18. but at some point (as you add more users or those existing users request more work or work that is more resource intensive). Please ensure that realistic inputs have been provided for the high-level configuration. Performance considerations 465 . Resource requirements for any specific user workload will vary depending on the complexity of the queries. and best performance practices. you suddenly have an influx of new customers. performance characterizations of systems hardware and software.4. More units of work means that more system resources are being consumed. These results are estimates and averages based on certain assumptions and conditions. The system recommendations are based on measurements of a fixed set of reasonably well-tuned queries.fm Figure 18-21 Sample output of work load estimator for DB2 Web Query Important: The use of the Workload Estimator and its results are restricted to the purpose of helping you predict a possible system solution.Draft Document for Review January 3.5 Concurrent users Unless they sign on to the system and do nothing. and are based on measurements and analysis with a variety of workloads (internal to IBM and by third parties). the workload definitions. the make-up of the database and the extent to which the queries have been tuned. Getting back to the dish washing analogy.

This again is where the DB2 Web Query WLE can prove to be helpful. Month”. 2010 1:16 pm dishes that need to be washed. Create an SQL view and synonym.5. However reports that were similar in nature. and change the report to use view.1 Identifying a long running report During unit testing.5. Create a new report based on the SQL view. looking for optimization disablers. 18. 18. 4. DB2 Web Query provides the Run w/SQL Trace option (Figure 18-22 on page 467) to run the report and generate an SQL trace. Identify a long running report. Frank and Gus may need some help. a case study is conducted against a long running DB2 Web Query report to delve further into performance analysis and demonstrate available optimization techniques. a larger sink. a report that was created using Report Assistant and the SQL CLI adapter was identified as one that required an excessive amount of time to run to completion. The objective is to determine why the particular report has an excessive runtime and provide example approaches in order to reduce the overall runtime.2 Performing analysis and looking for optimization disablers To help determine the reasons behind the substantial run time. named “Order Revenue within 180 days by Year. 3. Perform additional database analysis and tuning. meaning they had the same general format and approximately the same number of rows returned. or another dishwasher. perhaps in the form of more bussers. ran in seconds. 18. because it does consider the number of concurrent users in its calculations.5 Performance case study In this section. Much of this is obvious. Determine report tuning options. This report. The trace statements that are displayed help reveal any optimization disablers that might be present in the report. 2. 466 Getting Started with DB2 Web Query for i . The balanced system may need an adjustment. Perform analysis. 6. 5. but you may find it difficult to find the right balance.7214ch12. took several minutes to run. we describe the following steps: 1. In this section.fm Draft Document for Review January 3.

the Reporting Server was able to construct a meaningful SQL statement. The line in the trace “FOCUS IF/WHERE TEST CANNOT BE PASSED TO Chapter 18. the SQL trace information is displayed as HTML output to the browser as shown in Figure 18-23.fm Figure 18-22 Run w/SQL trace When the report is run using the Run w/SQL Trace option. Even though part of the translation failed.Draft Document for Review January 3. you can conclude that the problem with this report is the use of the define field DAYS_DIFF. 2010 1:16 pm 7214ch12. In this case. This trace reveals a couple of interesting points. notice how the trace shows the SQL statement that is generated (and what is ultimately submitted to the database engine). it shows that part of the report cannot be translated to SQL. translation failed for the Defined field DAYS_DIFF because of an unsuccessful IF/WHERE Test. First. Performance considerations 467 . Figure 18-23 Report trace results Using the trace. Second.

3 Determining report tuning options Tuning this particular report basically means selecting one of the following actions: Eliminate the culprit define field. 18. columns.5. particularly when the define field is part of the selection process. DAYS_DIFF” indicates that DB2 Web Query attempted (and failed) to generate an equivalent search condition for the SQL statement’s WHERE clause (Figure 18-24). For this example. only the third option remains to push the define field logic down to a database using SQL views. 468 Getting Started with DB2 Web Query for i . which now is responsible for the selection (and sorting if the report is sorted by the define field). a new result column is added to the view. If the define field cannot be passed to the database engine. Again. 18. the define field is absolutely required to deliver the necessary information in the report (and therefore cannot be removed). join syntax. Push the define field logic down to database using SQL views. 2010 1:16 pm SQL. and selection. Figure 18-24 Define field DAYS_DIFF Anytime a define field can be passed to the database engine. Example 18-4 shows this result column. In addition. a more efficient report results. which it is in the case of our example.7214ch12.fm Draft Document for Review January 3. To provide the ability to calculate the number of days between the date 1998-01-31 and the value of the SHIPDATE column. then all the rows from the result set of the generated SQL statement are returned to the Reporting Server. This kind of behavior that can negatively impact performance and should be avoided if at all possible.4 Creating an SQL view and synonym The next step is to create an SQL view that contains all the required tables. including the DAYS_DIFF field selection that DB2 Web Query was unable to directly translate to SQL. Modify the report in an attempt to enable SQL translation for the define field. it must be emphasized that the report is more efficient if the entire database access portion of the report definition can be pushed down to the database engine for processing. repeated efforts to fix the translation for the define field prove to be futile.5. Therefore. also named DAYS_DIFF.

After all the necessary modifications are made.DAYS_DIFFERENCE_VIEW AS SELECT T1."YEAR"."SHIPDATE". open a connection to the System i environment and open a Run SQL Script window. DAYS('1998-01-31') ."MONTH". Figure 18-25 Anatomy of the CREATE VIEW statement Notice that the local selection is removed from the CREATE VIEW statement.SHIPDATE) as DAYS_DIFF Chapter 18. 2010 1:16 pm 7214ch12. Ordering is specified in the report definition. Example 18-5 shows how the CREATE VIEW statement should look. Example 18-5 Create SQL view CREATE VIEW STAR1G. 2.T1.T1.SHIPDATE) AS DAYS_DIFF To create the new view: 1."CUSTKEY".DAYS(T1. From a System i Navigator. This is added to the statement that references the view. Performance considerations 469 .Draft Document for Review January 3."REVENUE_WO_TAX". Type the CREATE VIEW statement or use the SQL selection statement that is displayed in the trace as a base for this view definition and make the necessary modifications. Also observe that the ORDER BY clause is removed."CUSTOMER". Copy and paste the statement into the Run SQL script window and begin making the changes. This is because views cannot be ordered.DAYS(T1. T2. Figure 18-25 shows more details about what to add and remove from the selection statement to form the CREATE VIEW statement.T3.fm Example 18-4 DAYS_DIFF result column DAYS('1998-01-31') . For the copy and paste method.T3.

TIME_DIM T3 WHERE (T2.7214ch12. 18."CUSTKEY") AND (T3. Execute the statement to create the view. select Report Assistant to create a brand new report. select the new view. 2.Selecting a new view 3. From the browser. In the Select from available database descriptions window (Figure 18-26).CUST_DIM T2. 4.5 Creating a new report based on the SQL view When the new view and its synonym are in place. Figure 18-26 Report Assistant ."DATEKEY" = T1. From DB2 Web Query home page. Continue creating the new report with the view."CUSTKEY" = T1.fm Draft Document for Review January 3. STAR1G. Examples are shown in Figure 18-27 on page 471 and Figure 18-28 on page 472. open the DB2 Web Query metadata window and create a synonym against the new view."SHIPDATE") 3. specifying the same field format and selection criteria fields (as the original report). Click OK. a new report is created to access the contents of the view: 1.5. 2010 1:16 pm FROM STAR1G.STAR1G. 470 Getting Started with DB2 Web Query for i .ITEM_FACT T1.

2010 1:16 pm 7214ch12.Field selection tab Chapter 18. Performance considerations 471 .Draft Document for Review January 3.fm Figure 18-27 Report using SQL view .

significant improvements in performance are observed.7214ch12. using the view. From this interface. In V5R4. simple benchmark measurements reveal that the report. 472 Getting Started with DB2 Web Query for i . It is only intended to serve as an example of the kinds of efficiencies that you can obtain. Run the new report. your work might not yet be done. the SQE Plan Cache is an internal. so your results might vary. an interface to this information has been made available through the System i Navigator toolset. This is not meant to imply that you will experience the same improvements if you conduct such a tuning exercise. Many factors can affect report performance. In fact.6 Performing additional database analysis and tuning When your report is using the SQL view and all database processing is being handled by the database engine. You can potentially gain further efficiencies by performing regular database analysis and tuning. 18. 5. You can use the following tools and technologies to assist in this effort: SQE Plan Cache First made available in V5R2. Record performance measurements.5.Selection criteria tab 4. runs over 10 times faster than the original version of the report. Save the report and click Quit. you can find the SQL statement generated by DB2 Web Query and begin performing your analysis.fm Draft Document for Review January 3. matrix-like repository that is used to store all of the statements and access plans implemented by SQE. In the case of this example. 6. 2010 1:16 pm Figure 18-28 Report using SQL view .

Visual Explain’s detailed representation of the query implementation makes it easier to understand where the greatest cost is incurred.fm Visual Explain Visual Explain provides a graphical representation of the optimizer implementation of a query request. an MQT is a DB2 table that contains the results of a query. It can be thought of as an SQL tracing facility. If the optimizer determines that a permanent index against a reference table might be beneficial. Database monitor The Database Performance Monitor is a set of integrated tools that is used to collect database-specific performance information for all SQL requests. For this exercise. along with the query’s definition. refer to OnDemand SQL Performance Analysis Simplified on DB2 for i5/OS in V5R4. where it can be analyzed and used to identify and tune performance problem areas. this feature provides an easy and quick interface to index advisories that are issued by the optimizer. resources used.CUST_DIM ( CUSTKEY ASC . The data of the system-wide Index Advisor is placed into the SYSIXADV table in the QSYS2 schema.ITEM_FACT_CUSTKEY_SHIPDATE Chapter 18.CUST_DIM_CUSTKEY_CUSTOMER ON STAR1G. The query request is broken into individual components with icons that represent each unique component. CREATE INDEX STAR1G. Visual Explain also includes information about the database objects that are considered and chosen by the query optimizer. and aggregation have already been performed and the results stored in the MQT. For a more extensive discussion about this subject. Index Only Access The database optimizer can use Index Only Access if all of the columns specified in the SQL statement are represented in the index as key columns. SG24-7326. All this information is stored in a database tables. joining. it returns the key columns necessary to create the suggested index. Example 18-6 Indexes created for the case study CREATE INDEX STAR1G. Index Advisor Introduced in V5R4. CUSTOMER ASC ) PAGESIZE( 64 ) . Because the selection. one that tracks all SQL statements. 2010 1:16 pm 7214ch12. and subsequent performance results. Materialized query tables As mentioned previously. the database engine does not have to perform random access to the table to retrieve this data. Performance considerations 473 . great efficiencies can be gained if the optimizer uses this table for implementation.ITEM_FACT ( CUSTKEY ASC ) WITH 65355 DISTINCT VALUES .4. feedback from the optimizer (obtained by locating the statement in the SQE plan cache and launching Visual Explain) suggests the creation of the indexes shown in Example 18-6. access plans used to implement the statements.ITEM_FACT_CUSTKEY_EVI ON STAR1G. CREATE ENCODED VECTOR INDEX STAR1G. Because all of the columns that are necessary to satisfy the request are present in the index. “DB2 for i optimization” on page 451.Draft Document for Review January 3. The elimination of this additional I/O operation can result in significant improvements in query response times. Database performance analysis and tuning are rather broad topics that are briefly discussed in 18.

TIME_DIM ( "YEAR" ASC .6. each with a set of eight different queries or statements. 474 Getting Started with DB2 Web Query for i . 18. CREATE INDEX STAR1G. Simple benchmark testing reveals modest improvements to the runtime after these indexes are created.ITEM_FACT_SHIPDATE_EVI ON STAR1G.7214ch12.fm Draft Document for Review January 3. 2010 1:16 pm ON STAR1G. 18. to gather data on what is currently running on the processor (or processors).ITEM_FACT ( SHIPDATE ASC ) WITH 65355 DISTINCT VALUES . at user-defined intervals.TIME_DIM_YEAR_MONTH ON STAR1G. "MONTH" ASC ) PAGESIZE( 64 ) . Each query was run with ten different sets of host variable values to measure variances in selectivity and cardinality.ITEM_FACT ( CUSTKEY ASC . We measured the following scenarios of queries: Query/400 *QRYDFN objects (using the i5/OS RUNQRY command) DB2 Web Query running the *QRYDFN objects Direct SQL statements DB2 Web Query reports using the DB2 CLI adapter Direct SQL statements with all full open and re-optimization DB2 Web Query reports using the DB2 CLI adapter with all full open and re-optimization For each measurement. also known as TRPOF This is a sample-based trace that queries the processor. These indexes are created and the report is run again.1 Objectives The benchmark had the following objectives: Measure the overhead and resource usage of using DB2 Web Query product to execute existing Query/400 reports Measure the overhead and resource usage of running DB2 Web Query reports versus equivalent SQL statements 18. CREATE ENCODED VECTOR INDEX STAR1G.6 Performance benchmark A performance benchmark was conducted to help determine DB2 Web Query runtime performance expectations relative to the equivalent Query/400 objects and SQL statements.2 Scenarios The benchmark test bucket included six scenarios.6. SHIPDATE ASC ) PAGESIZE( 64 ) . we captured the following data: Total execution time for a given number of loops of the executed queries and reports Performance monitor data Task-profile trace.

This is the case due to server jobs being recycled after each DB2 Web Query Chapter 18. As expected.4 Metrics The measurement data was summarized into four key metrics: Minimum average response time per query Maximum throughput CPU usage Memory usage Minimum average response time per query The metric for minimum average response time shows the average response time per query for a single user. 18. All measurements reported were done with a one processor configuration. the direct SQL statements have the fastest response time. more like ad hoc queries. is significantly faster than the response time of the *QRYDFN objects. 7. The measurements were done on a Model 515 System i environment with one or two processors. Some response time increase is expected when running from a remote client. After running sets of measurements on the system.6. and six disk arms. With all queries incur full open and optimization. 2010 1:16 pm 7214ch12. The results of this metric are shown in Figure 18-29. The average response time (sec/query) is computed as the inverse of the measured throughput (queries/sec) for a single user running back-to-back queries with no think time.Draft Document for Review January 3.6.3 Database and system configuration For all of the benchmark measurements.5 GB of memory. Performance considerations 475 . although longer than the direct SQL statements. Figure 18-29 Minimum average response time chart Figure 18-29 shows that there is a moderate response time increase for *QRYDFN objects that are run through DB2 Web Query compared to *QRYDFN run through Query/400. a sample database with approximately 1 GB of data was used. This is primarily due to the efficiencies of the SQL generated by the DB2 Web Query running through SQE.fm 18. the DB2 Web Query response time is only slightly increased. The response time of the DB2 Web Query reports. it was determined that one processor was a better match for the amount of memory and number of disk arms on the system.

Resource usage: CPU The chart of CPU resource usage shows the amount of CPU resource used per query on average (Figure 18-31 on page 477). the Web Query maximum throughput is only reduced slightly. more like ad hoc queries. Maximum throughput The objective of measuring maximum throughput is to show the maximum number of queries per second that ran before reaching a system bottleneck. 2010 1:16 pm report.7214ch12. However the maximum throughput for the DB2 Web Query reports is much greater than the throughput of the DB2 Web Query *QRYDFN runs. the extra overhead of more full opens incurs in the base Web Query throughput numbers as well. This is the case due to server jobs being recycled after each Web Query report. DB2 Web Query introduces additional overhead compared to SQL. Figure 18-30 Maximum throughput chart The maximum throughput for *QRYDFN objects that run through the Web Query interface is almost equivalent to the maximum throughput of running the *QRYDFN objects through Query/400. 476 Getting Started with DB2 Web Query for i . This is due to the efficiencies of the SQL generated by the Web Query product running through SQE. the executed SQL statements have the greatest throughput.fm Draft Document for Review January 3. The CPU usage is then calculated as the CPU utilization divided by the queries per second at the maximum throughput point. This limit is measured by increasing the number of users who are running queries until no additional throughput is gained. With all queries incurring full open and optimization. The extra overhead of more full opens is incurred in the base DB2 Web Query response time numbers as well. such as processor or disk utilization. The CPU utilization is measured when the system was running at maximum throughput. See Figure 18-30. As expected. Therefore.

Figure 18-32 Memory usage chart Chapter 18. 2010 1:16 pm 7214ch12. running at a higher throughput rate. DB2 Web Query reports.fm Figure 18-31 CPU usage chart Figure 18-32 shows a small increase in CPU resource used when *QRYDFN objects are run through the Web Query interface compared to the CPU used by *QRYDFN objects run through Query/400. The smallest memory size measured with the high level of throughput is the memory requirement point. DB2 Web Query running *QRYDFN objects compared to *QRYDFN objects run through Query/400 require more memory. The chart also shows the dramatic reduction in CPU used by Web Query reports and SQL compared to the *QRYDFN objects. Resource usage: Memory The chart of memory resource usage shows the minimum amount of base pool memory needed to be able to maintain the corresponding maximum throughput rates shown in the maximum throughput chart (Figure 18-32). As expected. This is expected due to the additional server jobs used by DB2 Web Query. the plain SQL queries require the least amount of memory. Performance considerations 477 . This is due to the efficiencies of SQL running in SQE.Draft Document for Review January 3. Throughput for a fixed number of users is measured at various base pool sizes. The Web Query reports use more CPU than the equivalent plain SQL. The memory requirement is determined by collecting a memory curve. require about the same amount of memory as the *QRYDFN objects run through Query/400.

Therefore. there is little additional overhead.6. Comparisons of Web Query to SQL show that DB2 Web Query has longer response times. always keep in mind that SQL is being generated. use less much less CPU. Note that Web Query recycles the server jobs for every query. depending on whether the full open re-optimization was forced every time. If you are using DB2 Web Query to modernize Query/400 queries (by creating new reports). Figure 18-33 Benchmark results table 18.fm Draft Document for Review January 3. the DB2 Web Query reports run faster. This can primarily be attributed to the DB2 CLI adapter generating SQL and using the new SQL Query Engine (SQE). which again is expected when running to a client. 2010 1:16 pm Figure 18-33 lists the data used in the graphs in this section. 478 Getting Started with DB2 Web Query for i . an understanding of SQL performance basics is vital. The server CPU used is 9% more. and uses more resources. Comparisons of DB2 Web Query (using DB2 CLI adapter) reports to Query/400 *QRYDFN are positive. and more memory is required. and require about the same amount of memory.7214ch12. This result is expected when running to a client application as is the case with DB2 Web Query. If you are creating new reports. The CPU used by Web Query is two to four times the CPU used when running SQL.5 Conclusions We used the results of the benchmark to derive the following conclusions: Comparisons of the DB2 Web Query *QRYDFN versus the Query/400 *QRYDFN show an increased response time. Even with running to a client.

We have organized the questions into the following categories: “General announcement or product information questions” on page 480 “Installation and setup questions” on page 484 “Security-related questions” on page 484 “Named-user question” on page 486 “Metadata questions” on page 486 “Query/400 migration questions” on page 489 “Report development questions” on page 490 “Excel spreadsheet integration questions” on page 499 “Add-on product questions” on page 501 “Save and restore questions” on page 504 “Education questions” on page 506 © Copyright IBM Corp. 479 . All rights reserved.Draft Document for Review January 3.fm 19 Chapter 19. 2009. 2010 1:16 pm 7214ch13. we list frequently asked questions (FAQs) regarding DB2 Web Query. Frequently Asked Questions In this chapter.

You can extend DB2 Web Query into multidimensional analysis with the optional online analytical processing (OLAP) module or provide reports for users on the go with the Active Reports option. The DB2 Web Query Report Broker product (5733QU3) can be added to provide automated scheduling and E-mail distribution. What was announced? IBM delivered a new Web-based query and report writing product that offers enhanced capabilities over the IBM Query for iSeries (also commonly known as Query/400) product (5722-QU1).7214ch13. You can also simplify the management of reports by leveraging parameterized reporting. In addition. The DB2 Web Query Software Development Kit product (5733QU4) can be used to integrate DB2 Web Query content (reports and graphs) into other applications. we address general questions regarding the announcement and product information. You can easily modernize existing Query for iSeries definitions through an import function and then enhance them with the Web-based tools. you can interface to all data in i5/OS through either DB2 or Open Query File native adapters that automatically identify the files to be accessed and import the metadata into DB2 Web Query. which is called SQL Query Engine (SQE)).1 General announcement or product information questions In this section. a WYSIWYG report “painter. including reporting and graphing assistant components.” and the optional Developer Workbench for creating more customized reports. provides several easy-to-use tools for building business intelligence solutions. Access your DB2 for i or Microsoft SQL Server data from within Microsoft Excel 2002. you can deliver data to users in many different formats. 2010 1:16 pm 19. and Graph Assistant components. You can build new reports with ease through the Power Painter. DB2 Web Query offers features to import Query/400 definitions and enhance their look and functionality with Power Painter or Graph Assistant. Is there any reason to move to this new product? There are several reasons why you might want to consider using this new technology: Query/400 does not leverage the latest query optimization technology in DB2 for i5/OS. The DB2 Web Query SQL Server data adapter extends the reach of DB2 Web Query by allowing you to develop reports and graphs that access Microsoft SQL Server 2000 or 2005 databases. Report Assistant. and HTML or through the Java-based thin client interface browser support. including spreadsheets. The new product. PDF. DB2 Web Query offers the ability for the queries to use the query optimization features that have been added to DB2 for i5/OS over 480 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. In addition. What are some of the capabilities of this product? DB2 Web Query provides capabilities to query or build reports against data that is stored in DB2 for i5/OS and SQL Server databases through the latest browser-based user interface technologies. We are happy with our Query/400 reports. or later by using the DB2 Web Query Spreadsheet client. You can add OLAP-like slicing and dicing to the reports or view reports in disconnected mode for the user who are on the go. IBM DB2 Web Query for System i (5733-QU2).

anywhere. menus. Today’s requests for information demand that the data be delivered in many different formats and on a request. incremental upgrades to existing applications User administration savings Simpler and more controlled document backup and archiving Simpler and more controlled security and compliance administration Software updates controlled on the server making them available to all users concurrently What additional features are available with DB2 Web Query? The following additional capabilities are available that leverage the foundation set by DB2 Web Query: Active Reports The Internet makes vital information easily accessible to large numbers of people. filter data by different criteria. and monitoring capabilities of SQE. The OLAP feature solves the data analysis issues that business analysts face by adding in-depth. or scorecards or dumped into spreadsheets. By combining data and interactive controls into a single. users like these can take the power of business intelligence with them wherever they go.0 and AJAX Web technologies. with absolutely no software required. or alert basis. more time is spent building and processing reports than analyzing results and taking the appropriate action. Users can manipulate reports in various sort orders. Active Reports deliver analytic capabilities in a completely portable and disconnected environment. Query/400 is limited in its ability to meet these demands. The AJAX framework allows sophisticated report building capabilities including modeless and modal dialogs. The parameterized reporting feature of this new product can substantially reduce the number of reports that must be maintained individually. such as sales people who spend most of their time visiting clients or service professionals who travel from customer site to customer site? With the DB2 Web Query Active Reports feature. multiple coordinated windows. Frequently Asked Questions 481 . and more. Information must be provided via easy to interpret graphical representations. reducing the backlog of report writing requests. self-contained HTML file. but is now available to browser-based applications. A Web-based solution offers the following benefits: Lower installation costs Lower maintenance costs Easy. partial panel updates. and chart information for visual impact—anytime. It also allows any enterprise browser to be leveraged as the user interface. The zero footprint solution reduces complexity and costs. But what about mobile workers who are frequently disconnected from the Web. Why a Web-based query and report writing function? Is a Windows-based solution not more robust? The product is based on the latest Web 2. OLAP module Business analysts know that even a slight variation in the way they look at data often uncovers previously indiscernible trends and relationships and produce remarkable insights.fm the last few years. dashboards. scheduled. It allows you the functionality and usability that is usually associated with a Windows environment. If each new view requires a new report request. Chapter 19.Draft Document for Review January 3. automation. 2010 1:16 pm 7214ch13. DB2 Web Query leverages the improved performance.

Note: In order to leverage the OLAP functionality. With the base licensing model. each of these types of users must be explicitely registered to DB2 Web Query. With Run Time User Enablement. – Refresh data in a server-based Excel application or template. – Create new queries while working within Excel. combining multiple reports onto a single view. This new feature provides a solution that can be more cost effective and reduce maintenance DB2 Web Query Adapter for Microsoft SQL Server With this adapter you can extend the reach of DB2 Web Query with access to Microsoft SQL Server 2000 or 2005 databases. This metadata is created with Developer Workbench. Any run time user that is a member of one of those group profiles can gain access to DB2 Web Query without being explicitely registered. – Build spreadsheet reports that are automatically refreshed with updated data. or later. The Developer Workbench’s synonym editor is used for building metadata to hide complexities of the data from end users. such as decomposing date fields. They are simply allowed access through the group profile license (think of it as a ”family pass”). You can use the metadata interface to define relationships in the data. 482 Getting Started with DB2 Web Query for i . such as an ISV-supplied metadata layer. you can instead register the group profiles that secure the DB2 Web Query domains. this Excel Spreadsheet plug-in provides another level of integration by allowing you to start within the Excel framework and pull data into a spreadsheet using DB2 Web Query reports. It includes an HTML Composer for building compound reports or dashboards. Developer Workbench The DB2 Web Query Developer Workbench feature is an open and intuitive environment that allows for rapid development of more customized Web-based reports. – Burst data into multiple worksheets within the workbook. 2010 1:16 pm built-in analytical processing to the product's robust and scalable enterprise reporting and information delivery capabilities. This means that each one consumes a user license. applying preand post-calculation rules. the only supported DB2 Web Query data source was the IBM DB2 for i database. provides the metadata. This can greatly reduce the number of user licenses that are required and provides an attractive option for customers that need to support a large community of users that run reports.7214ch13. – Combine multiple reports from various data sources in a single worksheet. DB2 Web Query Spreadsheet Client Although you can create Excel spreadsheet reports with the base DB2 Web Query product.fm Draft Document for Review January 3. we recommend that either you have a license of Developer Workbench or another mechanism. such as defining the hierarchy of dimensions that automates the drill-down function of the OLAP feature. Prior to the availability of this adapter. Therefore. metadata that defines data relationships is required. The following features are provided with this plugin: – Access your DB2 for i or Microsoft SQL Server data from within Microsoft Excel 2002. Run Time User Enablement This option provides an alternative way to grant DB2 Web Query access for run time users (those that only run reports and perform no report development activities). or any of the hundreds of data manipulation functions. You can access multiple instances of SQL Server with a single DB2 Web Query Adapter and standardize on a single query and reporting solution for the enterprise.

which simplifies the whole reporting infrastructure for System i customers. or require multiple servers to support various reporting functions. Can a model 8nn system have the product QU2 installed? Any system that has a supported release of V5R4 can have the product ordered and installed. links to manuals. DB2 Web Query Software Developer Kit (SDK) The DB2 Web Query SDK (5733QU4) provides an API like interface to allow application developers to seamlessly integrate DB2 Web Query content into other applications. The URL is: http://www. enabling more report consumers to automatically receive reports in the formats they most prefer. Leveraging e-mail distribution lists. The IBM product is an i5/OS and thin client implementation.ibm.nsf/Request_for_Design_Change?OpenFo rm Post a thread on the developerWorks forum website mentioned previously. the following products are available to extend the base product’s functionality: DB2 Web Query Report Broker DB2 Web Query Report Broker (5733-QU3) adds a new level of scheduled report distribution. Software upgrades are simplified. network traffic is reduced.ibm. It is not intended to be a support site. 2010 1:16 pm 7214ch13. and security and auditing can be simplified. reliability can be increased. How do I submit a new request for product enhancement? There a couple of ways to submit New Feature Requests: Go to the following website for IBM i design change requests: https://www-912. Chapter 19. links to the KnowledgeBase (where many tips and techniques are documented). there is no IBM WebSphere or Rational® integration.com/r_dir/ReqDesChange. there is.com/developerworks/spaces/DB2WebQuery This website has things like an FAQ. I have several ideas on how DB2 Web Query could be improved. just a place you can come to get and share ideas. IBM hosts a developerWorks® site for DB2 Web Query. Report Broker enhances the number of output options available when reports are run in a batch mode. Frequently Asked Questions 483 .Draft Document for Review January 3. It also has a forum where you can post questions. Is there any integration with the Rational tools with this product? No. Is there a DB2 Web Query community where questions can be answered and ideas shared? Yes. Do I need to download data to a PC server or install a Windows server to sit between the client and the System i server? Many enterprise reporting tools on the market force you to move your data out of DB2. The GUI-based scheduler makes it easy to automate the report execution. Report Broker lets you run a report once but distribute portions of it to users based on the first sort field in the report. the resulting output of the scheduled report can be distributed automatically. with many options for running recurring reports.fm In addition. And with intelligent bursting.

htm) and only see limited configuration options. When I access the DB2 Web Query web console. add the following line to start DB2 Web Query: Attention: TCP must be active before you enter the STRWEBQRY command. one with more specific and limited functionality. By default. the system startup program QSTRUP runs with user profile QPGMR. IBM can provide documentation on how to change the ports used by DB2 Web Query on a case-by-case basis. However. Enter the following command and add user QPGMR with object authority *USE: EDTOBJAUT OBJ(QWEBQRYADM) OBJTYPE(*USRPRF) 2. Can I configure DB2 Web Query to start automatically after an IPL? Yes.3 Security-related questions In this section. 2010 1:16 pm 19. – I noticed that DB2 Web Query is using port 11331 for HTTP requests. If this is your only option. doing so can limit the ability of IBM to provide support for DB2 Web Query.fm Draft Document for Review January 3. we address questions regarding security.7214ch13. we strongly recommend that you change the other application to use a different port outside of that range.2 Installation and setup questions In this section. However if the reason you want to change the port is due to port number conflicts with another application. However it is important that the STRWEBQRY command always be run in a job with user profile QWEBQRYADM. How are the DB2 Web Query domains established? Only an administrative class user can create new domains. What if I am already using this port for something else? Is there any way to change it? DB2 Web Query demands the exclusive use of ports 11331 through 11339. Such a user must be a member of the group profile MRADMIN. we answer questions regarding the installation and setup of DB2 Web Query. I only see a limited number of options. Domain creation is a manual process that can only be performed by members of this group profile. 484 Getting Started with DB2 Web Query for i . SBMJOB CMD(QWEBQRY76/STRWEBQRY) USER(QWEBQRYADM) 19. contact IBM support for more details. To make sure that QSTRUP can start DB2 Web Query properly: 1. you are probably not signed in as the user profile QWEBQRYADM. In the CL program QSTRUP. Only this profile is able to see and use all of the web console configuration options Is the server-based processing performed by the WebSphere Application Server or something that requires less overhead? A lighter weight integrated application serving environment is used. The product does not require any WebSphere Application Server instances to be running. It is possible to change the port. If that change is not possible. you can. What happened to the other options? If you sign into the DB2 Web Query web console (http://systemname:11331/webquery_html/wfconsole.

fm Given that this is browser-based access. Frequently Asked Questions 485 . how is security established for users? First. if they are not authorized to the underlying database objects used by the report. the query execution fails accordingly. Similarly. user profiles that are members of the “report user” group profile can (only) run all reports within the associated domain. Can my DB2 Web Query reports run with adopted authority? Yes. the developer group profile is named MDSALESREP. Is auditing available for running a DB2 Web Query report? DB2 Web Query does not have an auditing tool. Can a more granular level of security be established. the program or stored procedure (or one in the subsequent call stack) must return at least one result set. the database open exit program. This means that users might see a report. Therefore. If you need the ability to run with adopted authority. when the report is executing. and user class named users are members of a group user profile name that is prefixed by MU. edit. how can domain authority be established? Use the Supplemental Group (SUPGRPPRF) parameter of the CRTUSRPRF/CHGUSRPRF command.Draft Document for Review January 3. In addition. but DB2 for i5/OS and i5/OS have tools such as the use of stored procedures for which specific logging can be done. to limit a report for a specific user? From the perspective of which reports are displayed to the user on the DB2 Web Query launch page. the report execution will fail. The developer class named users are members of a group user profile name prefixed by MD. object-level security that is implemented in the IBM i environment is honored. the answer is “No”. In order for DB2 Web Query to receive data back and create a report against that data. and the user level group profile is MUSALESREP. Each domain is associated with two group profiles: one for report developers and one for report users. Chapter 19. If that user has been registered as a named user. a user is allowed to work with reports within a DB2 Web Query domain. User profiles are then added to the appropriate group profile. You then create a synonym against that stored procedure. the SQL call-level interface (CLI) exit program. if the user who running the query does not have the appropriate authority to the underlying database object. if your domain is named SALESREP. users must log into DB2 Web Query using their i5/OS user profiles and passwords. and run reports within that domain. However. for example. My user profiles are already members of a group profile. If a user profile is a member of the “report developer” group profile associated with the domain. This parameter accepts multiple values and can also be used to establish the association of a user with a domain. From the launch page. normal i5/OS object-level security is enforced. 2010 1:16 pm 7214ch13. and object journaling. you must register an existing program (one with adopted authority) as a stored procedure. However. For example. there is currently no support for single sign-on environments such as Lightweight Directory Access Protocol (LDAP) and Kerberos. that user can create. Since this user profile parameter (GRPPRF) is already specified. access is allowed to the DB2 Web Query launch page. Domain level is the lowest level of security and determines which reports are displayed to a particular user. Is sign-on to the product available via LDAP or Kerberos? No.

“Registering named users” on page 28. established.4. etc) will be preserved during this process. The DB2 Web Query Developer Workbench tool does have an option to Refresh the metadata. for example by using an API? No. you can create SQL VIEWs. add the referential integrity definitions at the database level. refer to the section 3. This will update the synonym by adding any new columns (added to the underlying table) and removing columns (deleted from the table).7214ch13. For more details on this subject. If there is a known join relationship that is not defined to the database using DB2 for i5/OS referential integrity features. if you already have metadata against a table in place. iSeries Navigator From this interface. or removed? The DB2 Web Query product provides programs that are interfaces to the licensing APIs to both add and remove a user. Refer to 12. Alternatively. which provides an example of how to define this relationship. 2010 1:16 pm 19.3. It must be done manually. you can only delete existing synonyms. we provide answers to questions regarding named users. Therefore. to define the relationship. From this interface. you must manually refresh the table’s metadata before the new columns can be used in your reports. OLAP dimensions. Is there a way to automate the generation or refreshing of the metadata. IBM and Information Builders are investigating ways that might help you keep your metadata in synch with the tables that it is based on. How are named users managed. How do I manage my synonyms? Synonyms are stored in the integrated file system (QIBM\UserData\webquery\ibi\apps\baseapp directory) and can be managed from one of the following interfaces Windows Explorer You must first set up a mapped network drive. is there a way to define such a relationship in the metadata? Yes. new columns have been added). and that table has been altered (for example. Any customization made to the synonym (virtual columns.1.fm Draft Document for Review January 3.5 Metadata questions Here we address questions regarding metadata. 486 Getting Started with DB2 Web Query for i . there is neither metadata automation nor an API to build or rebuild the metadata. 19. or manually add the Join specifications for the reporting. “Joining tables” on page 354.4 Named-user question In this section. you can do this by creating synonyms from the Developer Workbench toolset. you can only delete existing synonyms.

The action also synchronizes the Master File with the table on which the synonym is based. virtual fields. 2010 1:16 pm 7214ch13. The ability to define appropriate dimensions for the OLAP module. description. you might prefer to create your reports against tables or views in a test library. usage. verify that the reports are correct. Frequently Asked Questions 487 . Developer Workbench From the Developer Workbench client. virtual field. – Domain-level report movement Use the drag features to move your domains from one system to another. By right-clicking the selected synonym. Within my reports. and then at some Chapter 19. – Refresh Synonyms Refreshing a synonym enables you to update field information while preserving the original synonym title. and business views. you see the list of available options as shown in Figure 19-1. and database administrator (DBA) information. how can I simulate a library list-like behavior when accessing the base tables and views? During the report development and testing phases. An interface for defining filters.fm WRKLNK command From this interface.Draft Document for Review January 3. you can only delete existing synonyms. Figure 19-1 Manage synonyms from Developer Workbench The following options are some of the more useful options that are available through this interface: – Synonym Editor The Synonym Editor provides exclusive features such as: • • • The ability to decompose date fields. you can do much more than simply deleting the synonyms.

To obtain the library list behavior and avoid creating a separate report for each data library. the library list behavior does not occur. or use an easier technique to change the library list of the job description that is defined to the user profile. this method is possible to carry out.html TechTip: Simulate One-Part Names for DB2 Web Query Synonyms over Stored Procedures http://www.fm Draft Document for Review January 3.7214ch13. change the report to point to data in a different (perhaps production) library. Creating separate versions of the report for each data library is one approach to consider. but is likely not desirable or practical if you have many reports to create and maintain. the requesting user’s library list is searched for the table or view names on which the synonym is based. therefore. Figure 19-2 Specifying one-part name during synonym creation Specifying one part name for the synonym prevents DB2 Web Query from hard coding the library name in the meta data. This means that you must either log in as a different user profile in order to have the report access data in a different library. this is implemented easily from many System i interfaces by using and manipulating your library list. However. you must select the One part name synonym setting as shown in Figure 19-2. For more information on this subject. your synonym is based on a table or view that is selected from a specific library.html 488 Getting Started with DB2 Web Query for i . As long as the formats of the files in the different libraries are the same. see the following articles: Making Better Use of DB2 Web Query with *LIBL http://www.com/tips-techniques/database/techtip-simulate-one-part -names-for-db2-web-query-synonyms-over-stored-procedures.mcpressonline. When the report (based on a one part name synonym) is run.mcpressonline. by default.com/database/db2/making-better-use-of-db2-web-query-wi th-libl. Typically. 2010 1:16 pm point.

either on another partition or in another server. this method will fail because the initial program is not executed during the DB2 Web Query session.1. “Setting up a cross-system join” on page 72. 19. Any other method of setting the library list is not recognized by DB2 Web Query. They still run and the Query/400 product is still supported. “Query/400: A reliable reporting tool” on page 428. you can build a “federated” query that combines data from many different back-end databases into a single DB2 Web Query report. and Power Painter) do not support the specification of left Chapter 19. Query/400 supported exception joins. if you are using the initial program (specified in the user profile) to manipulate the library list when the user signs on. Graph Assistant.fm Note: From a DB2 Web Query perspective. the user’s library list is determined and controlled by the system values QSYSLIBL and QUSRLIBL as well as the job description that is defined for the user profile. How do I migrate Query/400 reports into DB2 Web Query? Migration of queries is accomplished via an automated facility that allows you to select the query or queries that you want to translate and produces the new Web Query report ready to run or to be brought into one of the new user query components for customization. You can also combine data from multiple DB2 for i5/OS databases running on different servers or logical partitions (LPARs). 2010 1:16 pm 7214ch13. Frequently Asked Questions 489 . Can I query DB2 for i databases. without requiring multiple licenses of DB2 Web Query on each of these partitions or servers? With additional adapters as add-ons to DB2 Web Query. How do I specify that type of join with DB2 Web Query? The DB2 Web Query development tools available through the Web browser interface (Report Assistant. without requiring any additional adapters since the base product ships with the DB2 for i5/OS adapter. For more information about setting up a cross-system join.2. For example. see 3. even after you install 5733-QU2. Is there an automated way to import Query/400 objects? No. For more information about migrating Query/400 reports. see 17. This LPP is still required.Draft Document for Review January 3. Attention: Do not remove the Query/400 licensed program product (LPP) 5722-QU1. What happens to my existing queries when I upgrade to 5733-QU2? Nothing happens to your existing queries when you upgrade to 5733-QU2.6. we address questions regarding Query/500 migration.6 Query/400 migration questions In this section. The process to import queries is a manual one.

This is the only way to have the query processed by the SQE. Will the imported Query/400 definition start using SQL."StoreCode") 2."StoreCode" = b. you must take the following steps: 1. Here is an example of creating a view with an exception join: CREATE VIEW century/examplejoin AS ( SELECT a. If you need this functionality in your report. Will a Query/400 object that was previously imported still function as an imported report. Can an imported Query/400 query be saved with removal of reference to the existing query."LineTotal" from century/stores a LEFT EXCEPTION JOIN century/orders b ON a. The browser initiated work runs in the QSQSRVR jobs. right exception. Some Query/400 definitions are scripted in a CL program. Base your report on the synonym of the view.7 Report development questions Here. Will that be possible with DB2 Web Query? You can accomplish the same thing. b. b. so that one query produces output that will be used by the next query for input.fm Draft Document for Review January 3. The reports based on Query Definition objects are generated from the metadata that is available from the query object itself and will continue to be run using the RUNQRY which uses the Classic Query Engine (CQE). the object will still function as an imported report as long as the definition of the original Query/400 object is not changed to remove fields or existing fields are changed to an incompatible type with those in the existing metadata. A permanent library must be specified. we answer questions regarding report development. but use of the QTEMP library might be an inhibitor. Create an SQL view with the appropriate tables and join syntax. effectively creating an actual Web Query report from the imported query? No."StoreCode" = b."StoreName". A new Web Query should be created to replace an existing query. and there is no assurance that the QTEMP for one query will be the same as for the next query. 490 Getting Started with DB2 Web Query for i ."LineTotal" from century/stores a RIGHT OUTER JOIN century/orders b ON a."StoreName". 19.7214ch13. a new DB2 Web Query report must be created without reference to metadata from a query definition object."StoreCode") Here is an example of creating a view with a right outer join: CREATE VIEW century/examplejoin AS ( SELECT a. 3. and right outer join types. so that the SQL Query Engine versus the Classic Query Engine will be used? No. To fully detach the reference to the original query definition. even after the original query definition has been changed? Yes. Create a synonym against that view. to enable an SQL interface to the data. 2010 1:16 pm exception.

4. IBM Support does not provide assistance if you should experience problems. 3. open the desired domain. select the stylesheet files and click Save. from the list of style sheets.fm I have my own style sheets that I want to use for my reports. To make these style sheets available in the Report Assistant interface. Tip: Many sample style sheets are provided as part of the base product and can be used in your reports. they are available to every domain for importing. Copy your stylesheet files to the integrated file system directory \QIBM\UserData\webquery\ibi\webfocus76\basedir\import. 2. on the Reporting options tab. in the Content and generation pane. Select Report options tab. Chapter 19. specify the number of records that you want retrieved. To import.STY files to the directory specified in step 1 above and follow the remaining steps. Important: Do not forget to remove this setting prior to moving your report into production. After they are in that directory. To obtain this behavior: 1.STY and can be found in the integrated file system directory \QIBM\UserData\webquery\ibi\webfocus76\template. Open the report. How do I make them available from Report Assistant? In Report Assistant. Click Save. Failure to do so results in a report that does not retrieve all of the rows that satisfy the selection criteria of the report. In the Select Files to Add dialog window that opens. The style sheets are now available from Report Assistant. 2010 1:16 pm 7214ch13. right-click the Other Files folder. you might find it useful to restrict the number of rows that are returned and avoid waiting for all this information to be returned to the client. copy the . 2. To add your own style sheets to this list: 1. They have the file extension .Draft Document for Review January 3. How can I limit the number of rows that are retrieved during the report development phase? If you are developing reports that are retrieving large numbers of rows from the database. 3. Frequently Asked Questions 491 . As shown in Figure 19-3 on page 492. and select Import. Attention: Although custom style sheets should work in DB2 Web Query. you can specify a style sheet under the Apply an existing WebFocus Stylesheet field.

2010 1:16 pm Figure 19-3 Limiting the number of rows retrieved Can DB2 Web Query handle stored procedures with input parameters? Yes. However.fm Draft Document for Review January 3. you must specify a value for the input parameter during the synonym creation process. select this field as shown in Figure 19-4 on page 493. DB2 allows your stored procedures to have input parameters. 492 Getting Started with DB2 Web Query for i . When creating the report against the stored procedure. this value is not stored with the synonym definition and is not passed to the procedure during execution. From the Selection criteria tab. Although it must be specified here. you see the input parameter listed in the list of available fields.7214ch13.

can be used to determine which SQL statement was produced and submitted to the database engine. you must specify a different source synonym than the stored procedure. the i5/OS database features in iSeries Navigator. can more than one item be selected from the list? Yes. In parameterized reports. By using the standard Windows selection method. This option sends the SQL statement generated by DB2 Web Query to the browser. press Ctrl and click to add or remove a selected entry. such as the SQE Plan cache and Database Monitor. In addition. more than one item can be selected as long as the parameter was defined to allow multiple selections. 2010 1:16 pm 7214ch13.Draft Document for Review January 3. Frequently Asked Questions 493 .fm Figure 19-4 Using a stored procedure with an input parameter If you want the input parameter that is passed from the report to the stored procedure to be selected from a list. Chapter 19. For more information on using stored procedures as synonyms.html) How can the SQL that is produced for the report be viewed? You can view the SQL by using the Run w/SQL option.mcpressonline.com/tips-techniques/database/techtip-use-a-stored-proced ure-as-your-data-source-in-db2-web-query-for-i. see the following article: TechTip: Use a Stored Procedure as Your Data Source in DB2 Web Query for i (http://www.

you would like to show a detail report showing the columns Region and 494 Getting Started with DB2 Web Query for i . double-spaced printing is controlled by custom style sheets. The only limit is the existence of the report to process the link. For example. 2010 1:16 pm Can the currency symbol be set at the report level? Yes. In Report Assistant. drill down only works if the report is displayed via Excel embedded in the browser window.7214ch13. this is called conditional drill-down. Can a drill-down report have further drill-downs defined? The active link for the drill-down is just another report. and select EUR from the Currency Symbol drop down list setting. An example is shown in Figure 19-5. go to Report Options tab. Suppose your default currency is US dollars but you want one report to show currency as Euro. you can do this. However if the parent report is in the output format of an Excel spreadsheet. let’s say you have a parent report that shows the columns Country and Revenue (as a percentage of total). If the user drills down on the United States.fm Draft Document for Review January 3. Can I drill down to different reports based on the value of the column? Yes. Figure 19-5 Setting currency symbol in report Is there a way to specify double-spaced printing? Yes. If you have configured your browser to launch the Excel application automatically when opening the spreadsheet report. the drill-down capability is disabled. click the Fonts and Settings button. As many levels exist for which a report can represent another drill-down.

fm Revenue as US dollars. add conditions to check for “Country EQ United States” and “Country NE United States”. If you have dimension or measure columns in your OLAP report and you define an explicit drill-down to link to another report. If the user drills down on Germany (or any other European country). set up Conditional Styling on the Country column. However Developer Workbench provides an HTML Composer tool that is typically used to design a dashboard for an HTML interface such as a Web browser. This overall design is shown in Figure 19-6.Draft Document for Review January 3. you would like to show a detail report with Region and Revenue as Euro dollars. In the parent report. Chapter 19. and define drill downs for each of these conditions.one that shows currency as US dollars and the other as Euro dollars (to learn how to do this see “Can the currency symbol be set at the report level?” on page 494 above). To set this up. but you need to be careful. Can I create dashboards by using the Power Pointer tool? Power Painter enables you to specify multiple reports to appear on a single page. you will override the dimension/measure column’s default behavior which is to drill-down to the next level of the dimension/measure. attach them. they can. The best practice is to include a column that is not defined as dimension or measure and use that to link to other reports. Each drill down would execute the appropriate detail report (procedure). 2010 1:16 pm 7214ch13. This could even be a Define field with the text value such as ‘Click here to link to Revenue by Region Report’. you would create two separate detail reports . Figure 19-6 Setting up conditional drill-down Can OLAP Reports contain drill-downs to other reports? Yes. Frequently Asked Questions 495 .

. . . . REPORT (FEX) NAME . 3. . . . . If the Href has a leading number (#) 496 Getting Started with DB2 Web Query for i . . . .fm Draft Document for Review January 3. For example. . you see the Href value. . let us assume that you see the following value: db2wbqry/db2wbqry. OUTPUT QUEUE . Expand the tree until you see the report. the following statement refreshes the page every minute (60 seconds): <META http-equiv="refresh" content="60"> Can I run a DB2 Web Query report from within a CL program? Yes. For example. . 4. you can include graphics when building a dashboard by using the HTML Composer tool (part of Developer Workbench) or Power Painter. 2. . This is the value that you specify in the FOLDER parameter of the RUNWEBQRY command. The dashboard is a Web page. 5. OR HREF . . . the RUNWEBQRY command is delivered with the product and provides support for spooled file and database output options. 2010 1:16 pm When building a dashboard. you specify the value db2wbqry in the DOMAIN parameter. . . FOLDER NAME.7214ch13. you must specify the appropriate domain and folder HREFs of the desired report. Will the dashboard allow a periodic report. . OR HREF . . . In the Properties window. . . Figure 19-7 shows the format of the RUNWEBQRY command. which can have a large variety of elements placed for viewing. Insert a META statement after the <head> statement. In the Properties window that opens. To obtain this information: 1. . WP Character value Character value In order to run a report using this command. you see the Href value. OUTPUT FORMAT . can graphics be included. DOMAIN NAME. Right-click the domain that contains the report and select Properties. Figure 19-7 RUNWEBQRY command UNTITLED Character value Character value WP QPRINT *CURRENT DOC. Open a DB2 Web Query session using your Web browser. . . . . . RUN JAVA BATCH IN WEBQUERY (RUNWEBQRY) Type choices. . an effective automatic update? This can be accomplished by editing the HTML source (using the HTML Composer tool in Developer Workbench).htm In this case. Right-click the folder that contains the report and select Properties. . press Enter. . . which you specify in the DOMAIN parameter of the RUNWEBQRY command. . for example a company logo? Yes. . RUN WITH USER ID . . . . .

use of the RUNWEBQRY command requires the submitting user to be registered as a DB2 Web Query named user. Chapter 19. > visiblea56gb REPORT (FEX) NAME . if you are not a named user and you have sufficient authority to submit a job on behalf of another user profile. for example. . RUN WITH USER ID . . Frequently Asked Questions 497 . . Can report selection be defined on an expression? In many cases. There are limitations. your command looks like the example shown in Figure 19-8. . for example: app/newReport. report selection can be defined on an expression by using defined fields. . . I do not see “Database file” as an option for output format. . .Draft Document for Review January 3. . WP Character value Character value Figure 19-8 RUNWEBQRY command with values specified When I prompt (F4) the RUNWEBQRY command. If this user profile is a valid DB2 Web Query named user. do not include this in the parameter value. you specify the value visiblea56gb in the FOLDER parameter. the batch jobs submitted for this request run under the user profile that you specified. Do I have to be registered as a named user before I can use the RUNWEBQRY command? Yes. . . . such as expressions that use aggregate functions. .fex Excluding the leading “app/” and trailing “. . If you have “Database file” specified in the DB2 Web Query report definition. OUTPUT QUEUE . . . .fex” characters. OR HREF . . 2010 1:16 pm 7214ch13. . Right-click the report and select Properties. . RUN JAVA BATCH IN WEBQUERY (RUNWEBQRY) Type choices. You see the Filename value in the displayed Properties window. this setting is always honored in the RUNWEBQRY command. the request is allowed to continue. . even if you specify a target output queue in the command’s OUTQ parameter. When you do this. . . > newReport OUTPUT FORMAT . . However. > db2wbqry FOLDER NAME. . . . Therefore. WP QPRINT *CURRENT Character value Character value DOC. . this is the value that you specify in the REPORT (FEX) NAME parameter of the RUNWEBQRY command. . Putting it all together and using the example values that we provided. you can specify a valid named user in the USER parameter of the RUNWEBQRY command. in the case of the above example. . I thought this was one of the supported output formats. let us assume that you see the following value: #visiblea56gb In this case. . . . . . The RUNWEBQRY CL command does support output to a database file. press Enter. DOMAIN NAME. 6. Any other output format specified in the report definition results in the report output being sent to a spooled file when the CL command is invoked. . . the value specified is newReport. . This output option must be defined in the report itself. For example. OR HREF . . .fm character.

RIGHTMARGIN=0. I am generating reports to PDF output.fm Draft Document for Review January 3. 498 Getting Started with DB2 Web Query for i . 2010 1:16 pm percentage of total. You may also want to include the following statement so that the report is printed in landscape mode: ORIENTATION=LANDSCAPE Example 19-1shows an example of using these statements at the top of a style sheet. PAGECOLOR='WHITE'. ORIENTATION=LANDSCAPE. I am having a dickens of a time getting my reports to print with the proper formatting and page breaks. FONT='ARIAL'. SQUEEZE=ON. LEFTMARGIN=0. Is there any way to condense the report so that all columns are displayed on a single page? Yes.500000. you can squeeze the columns together and eliminate the unused white space by using a style sheet that contains the statement SQUEEZE=ON. you can use an SQL view or the SQL wizard to create a report with these requirements. When a report is generated to HTML.500000. Are there options to control the formatting when printing an HTML report? HTML is the suggested output format when you want to display the results interactively in a web browser. It is really not a good option when you want to print reports. PAGESIZE='Letter'. In these cases. With PDF you can control the formatting and get the page breaks you are looking for. $ TYPE=REPORT. BOTTOMMARGIN=0. How is a parameterized report designed. Example 19-1 Stylesheet with statements to improve PDF output UNITS=IN. The columns in the PDF document are too wide (there is much unused white space) and as a result.7214ch13.500000. BORDER=1. the columns are wrapped and shown on the next page. The recommended output format for printing is PDF.500000. TOPMARGIN=0. specifically to establish the inputs? The parameterized query defines the inputs using the HTML Composer in the Developer Workbench.

013889. 19. On the top of eachtotal numberreport. 2. How do I open my Excel spreadsheet reports in Microsoft Excel instead of the Web browser? By default. On this tab. your browser attempts to open the XLS file in the same browser session (using an XLS plug-in). These variables are described below: TABPAGENO Displays the current page number(s) in text. whenever you open a report whose output format is defined as an Excel spreadsheet. find and select XLS (Microsoft Excel Worksheet). For example.8 Excel spreadsheet integration questions For the following questions. How do I curent this? This can be done by specifying the system variables TABPAGENO and TABLASTPAGE in the page header or page footer sections of the report. Open Windows Explorer. b. I would like to include thespecify page number and page of my of pages in the report. TABLASTPAGE Displays the last page number of the report in the heading (or footing) text. BOTTOMGAP=0.027778. complete these steps: a. Overrides the default page number position of top left corner. Select Tools → Folder Options. In the Registered file types list. BACKCOLOR='NONE'. COLOR='BLACK'.Draft Document for Review January 3. Click the Advanced button.fm SIZE=9. you would specify this in the page header section of the report: Page <TABPAGENO of <TABLASTPAGE Note: Both variables must be preceded by the < character. 2010 1:16 pm 7214ch13. we provide answers regarding Excel spreadsheet integration. Select the File Types tab (Figure 19-9 on page 500). 3. Chapter 19.125000. TOPGAP=0. Frequently Asked Questions 499 . RIGHTGAP=0. If you prefer to have the spreadsheet opened in Excel: 1. STYLE=NORMAL.

Advanced c. make sure the “Confirm open after download” and “Browse in same window” options are not selected. Figure 19-10 Edit File Type d. In the Folder Options window. 4. 2010 1:16 pm Figure 19-9 Windows folder options . Click OK. Attention: Be aware that when you configure your browser to behave this way when opening an Excel spreadsheet. In the Edit File Type window (Figure 19-10). Close the Windows Explorer window and try again.7214ch13. 500 Getting Started with DB2 Web Query for i . you reports lose the ability to drill down to other reports. click Close.fm Draft Document for Review January 3.

9 Add-on product questions In this section.exe does not work for the full msexcel. One of the report output options is “Excel with formulas. The OLAP feature is enabled by defining dimensions for the database. specifying country as United States limits the States/Provinces list to only the states in the United States. we answer questions regarding add-on products.Draft Document for Review January 3. and the results of cells with formulas are automatically recalculated and updated.fm I have created a report with output to an Excel spreadsheet. for example delete a row. neither will allow the embedded viewing any more.is it no longer supported? This happens in both Vista (OS Level Change) and Office 2007 (Office Product Change). can the columns be sorted on demand (as they can be in Active Reports?) Yes.exe product. or later. It seems that Internet Explorer launches the spreadsheet outside of the browser. 2010 1:16 pm 7214ch13. This worked prior to Vista . drill down accesses another spreadsheet. 19. For example. Frequently Asked Questions 501 . but only if the spreadsheet is opened in the browser window. is the data limited based on prior selections? Yes. Does DB2 Web Query support integration with Microsoft Excel 2007? Yes. Unfortunately. What versions of Microsoft Excel will support the DB2 Web Query Spreadsheet client? You can use the DB2 Web Query spreadsheet client within Microsoft Excel 2002. so that no data associated with Canada is available to cascade in the list. Does drill down (clicking an active link) access another spreadsheet? Yes.” What does that really mean? Calculations and summaries are output to the Excel spreadsheet as formulas instead of literal values. Chapter 19. using an Excel plug-in to place the data from the referenced report in the browser window. Excel 2007 is supported. This way the recipient of that spreadsheet can do row or column manipulations. I am using Windows Vista and can not get drill-downs to work in my Excel Spreadsheet output. The drill down is active while in a browser. How does DB2 Web Query get those dimensions? The dimensions must be defined in advance using the Developer Workbench. you can re-sort the report. When cascading through data in an OLAP report. based on any of the displayed columns. Hence the session cookie in iexplore. In an OLAP report.

You can distribute reports via email or printer or you can have the report output saved to a folder in the report’s domain. Can a report developer create reports based on manually entered or imported SQL statements? Yes. In order to run the report. they can be used as the basis for DB2 Web Query reports. but is not part of the base product. by comparison to the amount of actual data included in the report. “Report Broker” on page 393. 2010 1:16 pm Does a copy of the Developer Workbench come with the base product? No. you can set up schedules to run your reports in a batch mode during off-shift hours (when more system resouces are available). select Tools → Internet Options. I understand that Active Reports can be sent to others via e-mail. Only the user that originally ran the report and generated the Active HTML output needs to be a named user.0). the SQL wizard feature of Developer Workbench provides an interface from which report developers can manually enter or copy and paste SQL statements. The definitional attributes to allow actively working with the data in the browser will be relatively fixed in size. it can be distributed to an unlimited number of recipients. In the browser. With Report Broker. How can I execute reports in batch and distribute automatically in PDF form via an e-mail distribution list? The DB2 Web Query Report Broker product (5733QU3) provides thie capability. Firefox has no native ActiveX capability. The Active Report file can be saved with the current formatting and visualizations specified by the user. Second. and consequently. cannot save the HTML file. you must make sure that your Internet Explorer browser settings are configured to enable ActiveX for Internet Explorer (version 6. To set this up correctly: 1. 502 Getting Started with DB2 Web Query for i . Why am I having trouble saving my Active Reports so that I can redistribute them? First of all. you must be using a browser that supports ActiveX technology. The recipients open the HTML file using a browser and can work with the Active Report in the same way as the original (named) user that created the HTML output can. Can an Active Report be saved with the active visualizations and any other changes made by the user? Yes. This means that only Internet Explorer can be used if you want to save your Active Reports to your hard drive. After the Active HTML output file is created.x and 7. The Developer Workbench is a feature of the IBM product. do the e-mail recipients have to be named users as well? No. as well as point to SQL script files that exist on the integrated file system. How large is an Active Report file? The size of an Active Report file depends almost entirely on the amount of data from a file. You can also specify the report output format you want generated and distributed.fm Draft Document for Review January 3.7214ch13. from the menu bar. For more information on DB2 Web Query Report Broker. none of which have to be named users (or even connected to the System i environment). refer to Chapter 15. As long as these SQL statements contain valid SELECT statements.

fm 2. click the Security tab. 4. Active X is now enabled and you can save your Active Reports. In the Internet Options window. Does Active Reports allow you to sort on more than one column? Yes.Draft Document for Review January 3. 2010 1:16 pm 7214ch13. 6. Frequently Asked Questions 503 . Active Reports will sort those values by the previously selected sort. If you take an action to sort by a column and that column has duplicate values. scroll through the menu and Select the Enable radio button for the following menu choices: – Run ActiveX Controls and Plugins – Script ActiveX Controls Marked Safe for Scripting – Initialize and Script ActiveX Controls not Marked as Safe for Scripting 5. The user then sorted by Model in ascending order. On the Security tab. Notice that the rows with the same Product Category value (such as Organizers) are sorted first in ascending order by Model and those with the same Model (VO-800) are ordered in descending order by Revenue. Click OK again to exit the Internet Options window. click the Custom Level button. In Figure 19-11. 7. followed by Product Category in ascending order. Figure 19-11 Sorting by multiple columns in Active Reports Chapter 19. Close and re-open the browser. the user first selected to sort by Revenue in descending order. but it is a multi-step process. 3. Each sort action will honor the previous sort specification to resolve the ordering of duplicate values. Click OK to exit and save. In the Security Settings window.

we provide guidance about save and restore.ibm. you must be concerned about the following components of DB2 Web Query: Synonyms (also referred to as metadata) All synonyms are stored in the integrated file system directory QIBM\UserData\webquery\ibi\apps.they are not stored anywhere on the IBM i server. 2010 1:16 pm If I add Comments to an Active Report.com/partnerworld/wps/servlet/ContentHandler/whitepaper/i/omnifin d/search OmniFind.com/database/db2/omnifind-part-i-add-sizzle-to-your-sq l-with-omnifind-text-search-server-for-db2-for-i. What is the recommended save and restore process for DB2 Web Query? From a save and restore perspective. the comments are added to that HTML file . will they be there the next time I run that report? No. Part I: Add Sizzle to Your SQL with OmniFind Text Search Server for DB2 for i http://www. we recommend that you save this directory frequently. When you run a report that goes to AHTML (Active Report) output format.mcpressonline.10 Save and restore questions In the following questions and answers. You can save that HTML file or even E-mail it and it will still have the comments.html 19. however. But when you rerun the report. I have important business information scattered about various columns in my DB2 for i database as well as PDF documents and Excel spreadsheets. Here are some links with more information about OmniFind and DB2 Web Query integration: Exploring the IBM OmniFind Text Search Server http://www. Part II: Integrating OmniFind Text Search Server with DB2 Web Query http://www.mcpressonline. it can be easily integrated with the IBM OmniFind® for DB2 for i product (5733OMF) to provide the features you are looking for.fm Draft Document for Review January 3. DB2 Web Query generates an HTML file. 504 Getting Started with DB2 Web Query for i . I would like to be able to perform full text-searching over these data sources for relevant information.com/database/db2/omnifind-part-ii-integrating-omnifind -text-search-server-with-db2-web-query. I would like to find all PDF documents and spreadsheets that contain the search string “2007 Financial Reports.7214ch13.html OmniFind. a brand new HTML file is generated and the comments do not appear in this new version of the report (but they do still exist in the original HTML file that you saved/emailed). For example. When you display that HTML file in the browser and add comments.” Does DB2 Web Query provide any full text-search capabilities? If so can it search these data sources? DB2 Web Query does not have built-in full text search capabilities. If you find that you are regularly creating or refreshing metadata information.

LIB/QGPL. you specify the following command: RST DEV('/QSYS.fm For example. To restore all the domains. simply save the directory QIBM\UserData\webquery\ibi as shown in the following example: SAV DEV('/QSYS. Frequently Asked Questions 505 .LIB/ALLREPORTS. For example to save all reports in all domains into a save file named ALLREPORTS created in the QGPL library. Use the copy and paste or dragging capabilities in Developer Workbench to perform these tasks.LIB/ALLSTUFF. 2010 1:16 pm 7214ch13. you specify the following command: RST DEV('/QSYS. However. to save all metadata into a savefile named SYNONYMS created in the QGPL library. for example. folders. This means that all reports within a particular domain are moved or deployed together. FOCEXECs.FILE') OBJ(('\QIBM\userdata\webquery\ibi\webfocus76\basedir' *INCLUDE '\QIBM\userdata\webquery\ibi\webfocus76\basedir')) ALWOBJDIF(*ALL) Note: If you are looking for the report files in the Common (untitled) Domain. you can find them in the QIBM\UserData\webquery\ibi\webfocus76\basedir\untitled\app directory.LIB/ALLREPORTS. domain-level movement is supported.acx extension) must be moved as a pair.FILE') OBJ(('QIBM\UserData\webquery\ibi\apps' *INCLUDE 'QIBM\UserData\webquery\ibi\apps')) ALWOBJDIF(*ALL) Reports (also referred to as Focus Execs.LIB/QGPL. and FEXs) All reports are stored in the integrated file system directory QIBM\UserData\webquery\ibi\webfocus76\basedir\domain_name (where domain_name equals the name of the domain in which the report was created). and reports to the target system.LIB/SYNONYMS. If you want to save both synonyms and reports in one step. on which the synonyms are based must exist on the target system. you enter the following command: SAV DEV('/QSYS. you enter the following command: SAV DEV('/QSYS.mas extension) and the access file (. Otherwise any reports that references the synonyms will fail to execute. Chapter 19.LIB/SYNONYMS.LIB/QGPL.Draft Document for Review January 3.LIB/QGPL. Both the master file (.LIB/QGPL. save the directory QIBM\UserData\webquery\ibi\webfocus76\basedir. and stored procedures. views. To save all reports (distributed throughout the various domains).FILE') OBJ(('\QIBM\UserData\webquery\ibi' *INCLUDE)) Can I move or deploy synonyms and reports individually? Synonyms can be copied or moved individually using either Windows Explorer (and mapped network drives) or Developer Workbench (the recommended tool for this type of activity).FILE') OBJ(('\QIBM\UserData\webquery\ibi\apps' *INCLUDE)) To restore this metadata on the target system. Keep in mind that the tables.FILE') OBJ(('\QIBM\UserData\webquery\ibi\webfocus76\basedir' *INCLUDE)) Similar to the synonyms. Individual reports cannot be copied or moved to another system. we recommend that you save this directory periodically or more frequently if reports are created and updated on a regular basis.

. Where can I find more training for DB2 Web Query? Refer to the DB2 Web Query Web site at the following address and click the Getting Started tab: http://www-03.html IBM provides a developerWorks Space for Web Query.7214ch13. there is a 506 Getting Started with DB2 Web Query for i . map a network drive for both the source and target systems. new announcements.11 Education questions In this section. including recent APAR information. It also includes links to find more information about add-on components available from Information Builders. you see the message “This folder already contains a folder named.” Click the Yes to All button. Attention: Domain movement does not work from Windows Explorer if you skip step 1.. you can find links that provide more information about this subject. you can use Windows Explorer with mapped network drives to move domains: 1.com/systems/i/software/db2/webquery/index. and so on) other reports or procedures that reside in another domain.com/systems/i/software/db2/webquery/ This Web site is updated with the latest information about the product. In addition. The name of the target domain must match the name of the source domain. problems might occur if your reports reference (via drill downs. This space includes a wiki containing the latest information and documentation on the Web Query product. From Windows Explorer.ibm. In addition. From Windows Explorer. 2010 1:16 pm Note: When moving or copying domains to another system. Where can I find more information about the product? You can find more information about the DB2 Web Query for IBM i home page at: http://www. including success stores of customers who have implemented business intelligence solutions on the System i platform. we refer you to resources for education regarding DB2 Web Query on the System i platform. 4.ibm. In addition. and downloadable demonstrations. 3. hyperlinks. In the Confirm Folder Replace window. Manually create the domain on the target system (from DB2 Web Query home page or Developer Workbench). 2. 19.fm Draft Document for Review January 3. drag the source domain directory to the target directory T:\QIBM\userdata\webquery\ibi\webfocus76\basedir (where T is the target mapped network drive letter). if you are interested in business intelligence solutions on the System i platform.

the service is available on an annual subscription basis for a nominal fee. white papers. System i eLearning training is available on the Information Builder Web site at: http://education.com/developerworks/spaces/DB2WebQuery In addition.Draft Document for Review January 3. Following the 30-day trial.ibm.informationbuilders. Frequently Asked Questions 507 . and general tips/techniques published for the DB2 Web Query product. best practices.ibm.html Registrants to the training have access to the site for 30 days. Use the forum to submit your questions to a wide range of Web Query users and IBM experts.com/edu/Systemi. I have noticed that there are many articles. You can access the Web Query Space at: http://www. 2010 1:16 pm 7214ch13. there is! Go to this website: http://www.com/developerworks/wikis/display/webquery/DB2+Web+Query+for+i+Artic les Chapter 19. Is there a centralized website that contains links to all of these publications? Yes.fm highly active forum for Web Query.

7214ch13. 2010 1:16 pm 508 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3.

“Metadata in the integrated file system” on page 511 Appendix B. “Additional material” on page 569 © Copyright IBM Corp. “Change Management considerations” on page 565 Appendix E. 2010 1:16 pm 7214p06. All rights reserved. This part includes the most frequent asked questions and the following appendixes: Appendix A. 2009.Draft Document for Review January 3. 509 . we explain more specific topics on DB2 Web Query. “ate and time functionality” on page 513 Appendix C. “Processing differences between the define and compute fields” on page 563 Appendix D.fm Part 6 Part 6 Appendixes In this part.

2010 1:16 pm 510 Getting Started with DB2 Web Query for i .7214p06.fm Draft Document for Review January 3.

Figure A-1 Master file for the QWQCENT/ORDERS table © Copyright IBM Corp. 2010 1:16 pm 7214ax01. we provide a more detailed explanation of what is created on the IBM i environment when DB2 Web Query metadata is created. This file is similar to the information in a DSPFFD file. but the information is described in a way in which DB2 Web Query understands. if the object is a QRYDFN.fm A Appendix A.mas. Figure A-1 shows a master file for table QWQCENT/ORDERS. Metadata in the integrated file system In this appendix. All rights reserved. The file that is created is called a master file: Master file: This file identifies the fields of the table or. 2009. 511 . Every time a synonym is created in DB2 Web Query.Draft Document for Review January 3. The fields are described in terms of length and data type. the fields of that query’s result set. The master file has an extention of . The file is located in the directory '/qibm/userdata/ibi/apps/baseapp'. one file is automatically created in the integrated file system that allows DB2 Web Query to read from that object.

1. The access file has an extention of . select option 4 and press Enter to delete. If the object type is a table. . it says QIQRY. Select option 5 by BASEAPP.txt and . enter the following command: WRKLNK '/QIBM/USERDATA/IBI/APPS/BASEAPP' 2. the master file is correctly updated. Therefore. From the System i command line. Browse the BASEAPP directory for the metadata that you want to delete. Figure A-2 shows an access file for table QWQCENT/ORDERS. you can manually delete the metadata. If you change the underlying table or QRYDFN.fm Draft Document for Review January 3. For QRYDFN objects. 512 Getting Started with DB2 Web Query for i .acx. and if you recreate the metadat with the “overwrite” option. 2010 1:16 pm Some adapters also have an access file: Access file: This file identifies the object name and type on which the metadata is created.inf. Figure A-2 Access file for the QWQCENT/ORDERS table The Heritage adapter does not have access files when created over physical files. When you find it. Deleting metadata There is no interface in DB2 Web Query to delete metadata. it says TABLENAME. If the object is a QRYDFN. there are three additional metadata files: . A new master file is not created.fex. but does when created over logical files with an access path.7214ax01. nor will anymore be written. you do not need to manually delete any metadata if you only used the “overwrite” option. If you know that there are no more reports based on this object. 3.

2010 1:16 pm 7214ax02. ate and time functionality Date support is strong in DB2 Web Query. 2009. 513 .Draft Document for Review January 3. All rights reserved. © Copyright IBM Corp. we have reproduced it here. Because the information is not in the help text for the base product. You can find most of the details in this appendix in the help text that is provided with Developer Workbench.fm B Appendix B.

such as year. 514 Getting Started with DB2 Web Query for i . Useful for numerical comparisons. Returns the current (four-digit year) date. Returns the current time that the query was executed. Y.fm Draft Document for Review January 3. month. quarter. 2010 1:16 pm Date and time system variables Table B-1 lists the date and time variables that are available in DB2 Web Query. &DATEMtrDYY Description Returns the current date. M. Instead. Date format display options The date format does not specify type or length. YYYY Example (for October 07. Sort reports into date sequence. YYYY Name of day of week. Name of month DD.07 091007 20091007 Wednesday October 7. you can perform the following tasks: Define date components. Returns the current date. W. Returns the current (four-digit year) date. Returns the full name of the day of the week Returns the name of the month followed by the day and the four digit year Returns the full name of the day of the week. without date smarts.MM. it specifies date component options (D. April alphabetically comes before January. and YY) and display options. 2009) 10/07/2009 071009 07102009 100709 10072009 15. Returns the current (four-digit year) date.7214ax02. and day of week. followed by the name of the month followed by the day and the four digit year Format or value MM/DD/YY DDMMYY DDMMCCYY MMDDYY MMDDCCYY HH. These options are shown in Table B-2 on page 515. 2009 Wednesday. For example. Q.SS YYMMDD CCYYMMDD Name of day of week Name of month DD. Returns the current date. January sorts before April even though.50. Returns the current date. Table B-1 Date and time variables System variable &DATE &DMY &DMYY &MDY &MDYY &TOD &YMD &YYMD &DATEWtr &DATEMtrDYY &DATEWtr. 2009 Date format The various date formats enable you to define a field as a date and work with it as a date. Do arithmetic with dates and compare the dates without resorting to special date-handling functions. day. regardless of how the date appears. October 7. and extract them easily from the date fields. Using the date format.

Q4. Used in combination with other date options. January 3. Table B-3 Sample output for date formatting options Translation MT Mt MTR Mtr WR Display JAN Jan JANUARY January MONDAY Appendix B. For example. On its own. but displays the full name in mixed case. ate and time functionality 515 . Displays a four-digit year. but displays the full name in uppercase. Displays a value from 1 to 12 for the month. When used with M in a date (MT or TM). tr is like t. except that the first letter is uppercase and the following letters are lowercase. t Translate month TR tr Q W Translate month or day Translate month or day Quarter Day-of-Week w Day-of-Week WR Day-of-Week wr Day-of-Week JUL YYJUL Julian format Julian format Table B-3 shows samples of output for various date formatting options. except that the entire day name is displayed instead of an abbreviation. Functions the same as lowercase w (described above). When used with M in a date (Mt or tM). TR is like T. W displays the number of the day of the week (1-7. Displays date in Julian format. Displays the quarter Q1 . the three-letter abbreviation for the month in uppercase is displayed. The 7-digit format displays the four-digit year and the number of days counting from January 1. W displays a three-letter abbreviation of the day of the week in uppercase. Displays a Julian format date in the format YYYYDDD.Draft Document for Review January 3. Mon=1). the three-letter abbreviation for the month is displayed.fm Table B-2 Date format options Display option D M Y YY T Meaning Day Month Year Four-digit year Translate month Effect Displays a value from 1 to 31 for the day. except that the entire day name is displayed instead of an abbreviation. 2010 1:16 pm 7214ax02. Functions the same as uppercase W (described above). Displays a two-digit year. 2001 in Julian format is 2001003. capitalizing only the first letter of the month or day. Functions as uppercase W (described previously).

Q. the date components are displayed separated by a slash character (/). The date components can be specified in any order.fm Draft Document for Review January 3. or can be eliminated entirely.7214ax02. 516 Getting Started with DB2 Web Query for i . 94 Q3 or Q3 1994). and display options are ignored. such as YMD and MDYY. or a blank. W. The separating character can be changed to a period.'1999 APR 25' IF MYDATE GT '25 APR 1999' Date fields in arithmetic expressions The general rule for manipulating date fields in arithmetic expressions is that date fields in the same expression must specify the same date components.) Using date fields Table B-5 shows valid examples of specifying dates. The year-quarter format is displayed with the year and quarter separated by a blank (for example. In basic date format.12. Table B-5 Examples of specifying the dates Situation In WHERE screening In arithmetic expressions In computational date comparisons Natural date literal WHERE MYDATE IS 'APR 25 1999' MYDATE .) 931224 (The concatenation symbol “|” eliminates the separation character.D Y-M YBMBD Y|M|D Display 93/12/24 93. a dash.24 93-12 93 12 24 (The letter B signifies blank spaces. The single component formats display just the single number or name. and D. Table B-4 shows the FORMAT specifications that can be used to change the separating character. M.M. Table B-4 Date separators Format YMD Y. The same is true for the year-month format. 2010 1:16 pm Translation wr Q YQ Display Monday Q1 07Q1 Controlling the date separator You can control the date separators when the date is displayed. Valid date components are Y or YY.

NEWQUARTER and THISQUARTER both have FORMAT specifications of Q. calculations. or aggregating the data against a date. But getting back to the original question. In date component conversion. the value of a date format field can be assigned to an alphanumeric or integer field that uses date display options. the remainder of 5 divided by 4). 2010 1:16 pm 7214ax02. the answer is. Converting date fields "Can DB2 Web Query handle my legacy date fields?" It's a good question: dates and times are vital business dimensions that are required in most business reports. many IBM i shops use legacy date data types. and the value of THISQUARTER is 2. sorting. the date/time dimension is an integral piece of information. and day All of these things enable the report developer to deliver a report that is easy to use and to provide the report formatting and information that is required. how often do you create a report against data in your database without filtering. The following example calculates the number of days elapsed since January 1. Legacy dates are typically defined as numeric or alphanumeric fields that contain numbers or character strings that represent the date.'JAN 1 1999' . the value of REPORTDATE (DMY) can be assigned to SALESDATE (Y). DB2 Web Query can handle your legacy date fields. When the tool recognizes fields as dates. For example. quarter. it can provide some additional reporting features: Advanced date/time manipulation. consider the following statement: NEWQUARTER = THISQUARTER + 3 This statement gives NEWQUARTER a value of 1 (that is. 1999: YEARTODATE = ORDERDATE .0). SALESDATE is 99. in this case. Appendix B. the reverse conversion is also possible. and analysis Report selection parameters that can be specified by invoking JavaScript calendar widgets for a more user-friendly experience Date decomposition to break the date into separate fields that represent the year. ate and time functionality 517 ." This section describes how to implement two different techniques of converting legacy date formats to fields that DB2 Web Query recognizes as true date fields (also referred to as "smart dates"). In this case. If REPORTDATE is Apr 27 99.fm For example. This section focuses on date conversions. the year is extracted from REPORTDATE. After all. a field whose format specifies one set of date components can be assigned to another field by specifying different date components. An example of this is a field defined as zoned decimal (8. In format conversion. this field is nothing more than a decimal field. When it comes to storing date values in their database files. the fact that it actually stores date data is not known to tool. 2008. Two types of conversions are possible: format conversion and date component conversion.or time-related field? For most reports. month.Draft Document for Review January 3. "Yes. which contains the value 04102008 to represent the date April 10. However. to DB2 Web Query.

From your browser sessin. For example. create a new report Using Report Assistant 3. MDYY refers to the full MM/DD/YYYY format In this exercise. select cen_orders as the report’s data source 4. From list of available fields. all that may be necessary is changing the Usage attribute in the file's DB2 Web Query synonym. Drag LINETOTAL into Sum pane c. From the list of synonyms. Drag COSTOFGOODSSOLD into Sum pane When you have finished the report should look like the example provided in Figure B-1 on page 519.7214ax02. drag ORDERDATE into Sort by pane b. From your Tutorials folder. Note: YYMD is the "short name" used to refer to the actual YYYY/MM/DD format.fm Draft Document for Review January 3. If this is indeed the case. you will convert the order date field from the YYMD format (as it is stored in the database) so that it is displayed in MDYY format on a DB2 Web Query report. You may be ahead of the curve and have already implemented true date/time fields in your DB2 for i production database. do the following a. 2010 1:16 pm Changing the usage Before you begin with any actual date conversion efforts. perhaps you are storing the date columns in YYMD format and simply want those dates to appear in DMYY format on your reports. In the Report Assistant tool. you first need to determine if date conversions in your company's DB2 Web Query environment are even necessary. and you simply want to display the dates in your reports differently that how they are stored in the database. log into DB2 Web Query as a developer 2. 1. 518 Getting Started with DB2 Web Query for i . Similarly.

2010 1:16 pm 7214ax02. Save the report as Revenue by Order Date 6. ate and time functionality 519 . you see Revenue and Cost of Goods Sold ordered and grouped by order date. Figure B-2 Results of Revenue by Order Date report Appendix B. Run the report In this report (Figure B-2 on page 519).fm Figure B-1 Revenue by Order Date report 5.Draft Document for Review January 3.

Open DB2 Web Query Developer Workbench and open a connection to your environment 8. 10. 7.mas synonym file and select Edit in Synonym Editor from right click menu The synonym editor is opened. Notice that the Order Date column is now presented in MDYY format (Figure B-4). 2010 1:16 pm This is a useful report. Find and right-click on the cen_orders.Select the ORDERDATE field. Notice that this is a "true" DATE field (see the ACTUAL attribute) and its USAGE value is YYMD (which is how it is defined in the database). you need to take additional steps to override this attribute when displaying the date field in a DB2 Web Query report.Return to your DB2 Web Query browser session and click on the Revenue by Order Date report again to run it.7214ax02.The USAGE field changes to MDYY. 520 Getting Started with DB2 Web Query for i . These steps involve changing the usage value of the order date field as defined in the synonym of the file this report is based on. 12. but suppose your users really want the order date shown in MDYY format. To update the synonym you will use DB2 Web Query Developer Workbench. Because the order date field in your database is defined as YYMD format.fm Draft Document for Review January 3. As shown in Figure B-3 on page 520. Click the save icon to save this change. Expand Data Servers → EDASERVE → Applications → baseapp' 9. override this attribute by selecting MDYY from the Date Order setting under USAGE Figure B-3 Change date order 11.

In this exercise. The measure shown for each of these groupings will be the aggregated order amount . follow these steps: 1. This true date field is used as the basis for other virtual columns in other formats such as year and day of the week. However. You create a report that uses these virtual fields is in a two dimensional format: sorted/grouped vertically by the year of the order and sorted/grouped across by the name of the day of the week. Attention: You could also create these virtual fields in the synonym (rather than in the report). Give it a prefix of cen_ 3. 2010 1:16 pm 7214ax02. ate and time functionality 521 . Create a new Report Assistant Report in the Tutorials folder.Draft Document for Review January 3. To perform date conversions using the DB2 Web Query BIFs. which contain the value 04102008 to represent the date April 10. You use the DB2 Web Query built-in functions (BIFs) to convert these fields to virtual fields that is defined as a true date. Create a DB2 Web Query synonym over the LEGACY_ORDER_HEADER table.0). but for the purpose of this exercise. you may have date fields defined as packed decimal (8. Consequently. In fact.0) “date” fields with this MDYY format. 2008. the conversions are performed in the report definition. you probably have date fields defined as a data type other than date or timestamp (because these data types were not supported and supported by the RPG compiler until V3R1 of the operating system). as mentioned earlier. Open DB2 Web Query in a browser session and log in 2. Appendix B. the file used has packed decimal (8.fm Figure B-4 Results of Revenue by Order Date after changing usage Using DB2 Web Query functions to convert to dates Changing the usage field may be enough if your date fields are defined as true date fields in your database and all you want to do is change the month-day-year order of how the date is displayed. this would be the recommended approach. if you are like many IBM i shops.

Figure B-6 Create new define field To convert the packed decimal fields to dates. Figure B-5 Select synonym d. 2010 1:16 pm 4. select CEN_LEGACY_ORDER_HEADER as the data source as shown in Figure B-5. use the DATECVT function. create a New define field by clicking on the down arrow by the calculaor icon and selecting New define field as shown in Figure B-6 on page 522.7214ax02. in either the desired standard date format or legacy date format. This function converts the field value of any standard date format or legacy date format into a new date. 522 Getting Started with DB2 Web Query for i . From the list of displayed synonyms. These are the parameters for this function: – date is the input legacy field to be converted. In Report Assistant.fm Draft Document for Review January 3.

specify the following and click OK: – Field: OrderDate (this is the new virtual column name) – Format: MDYY (this is the output date format of the new virtual column) – Expression: DATECVT( ORDDAT. M. DMY. A8MDYY. always ignore extra digit(s) when specifying the value of the input format parameter. YQ. 'P8MDYY'. ate and time functionality 523 . – output_format is the output date format. 2010 1:16 pm 7214ax02. 5. JUL.0) field. This is normal . I6YMD. you will notice that it is defined as P9 (rather than P8). From the Define Field Creator window. Specify the following attributes and click OK: – Field: OrderYear – Format: YY – Expression: OrderDate An example is provided in Figure B-8 on page 524.Draft Document for Review January 3. Examples: YYMD. 'MDYY' ) An example is provided in Figure B-7 on page 523. I8MDYY.the extra digit is used to store the decimal point.fm – in_format is the format of the input legacy date. Figure B-7 Define field for ORDERDATE Note: ORDDAT is a Packed Decmial (8. Examples: P8MDYY. If you inspect the DB2 Web Query synonym for the this field. Appendix B. Create another define field to display just the year of the OrderDate column. For the purposes of date conversion. in this case the value should be P8MDYY 6. So.

Specify the following attributes and click OK: – Field: OrderDayOfWeek – Format: WT – Expression: OrderDate An example is provided in Figure B-9.fm Draft Document for Review January 3. etc.7214ax02. Figure B-9 Define field for ORDERDAYOFWEEK 524 Getting Started with DB2 Web Query for i . 2010 1:16 pm Figure B-8 Define field for ORDERYEAR 7. Create another define field to display the day of the week (MON. TUE.) of the OrderDate column.

Drag OrderDayOfWeek field into the Sort across pane. the report definition should look like the exampe provided in Figure B-10. Click on the Show field options icon for this field. c. Add comma inclusion and floating currency formatting to the ORDAMT field by adding CM to the end of the Format in report as setting. b. d. When finished. 8. Run the report.fm Attention: A full list of date display formats can be found in “Date format display options ” on page 514.Draft Document for Review January 3. 2010 1:16 pm 7214ax02. e. Appendix B. It should look like the example displayed in Figure B-11. Figure B-10 Report using Define fields for date conversion 9. ate and time functionality 525 . Finish the report by performing the following: a. Drag the ORDAMT field into the Sum pane and select it. Drag the new OrderYear field into the Sort by pane.

This can be done by any of the following techniques: Implementing Referential Integrity (setting up Primary and Foreign Keys) Creating an SQL view with syntax to join your legacy files to the date conversion table Defining the join in the DB2 Web Query synonym Defining the join in each DB2 Web Query reports/graphs When the report is run. winter) Same day (of the week) last year Week ending date Week of the year Super Bowl Sunday flag (Y or N) Day before a holiday flag (Y or N) Day after a holiday flag (Y or N) Full moon flag (Y or N) And so on In order for this technique to work. Your reporting and business intelligence requirements will dictate how many date value representations you add to your conversion table. autumn.) Month of the year (January.Press the Quit icon to exit Report Assistant Using date conversion table to convert to dates Also referred to as a calendar table. 11. the date conversion table must have a column that represents the date in the same format as the legacy file.providing the report with all the various columns representing that particular date.fm Draft Document for Review January 3. 526 Getting Started with DB2 Web Query for i .7214ax02. Tuesday. You then define an inner join from the legacy file to the date conversion table using the legacy date fields as the join columns. 2010 1:16 pm Figure B-11 Results of report that uses define fields for date conversion 10. Each row is made up of columns that represent the same date value in various ways (for example. the day of the week). DB2 Web Query uses the chosen join definition method to generate the SQL syntax necessary to join the legacy file and the date conversion table. For example.) Season (spring. etc. summer. etc. February. For each row returned in the legacy file.‘Save your report as Date conversion using Web Query functions. a date conversion table could include the following columns: Julian date Date (a "true" DB2 date field) Fiscal year Fiscal quarter Day of the week (Monday. the matching row (for that date) of the date conversion table is also returned . a date conversion table is simply this: a DB2 for i table that contains one row for each individual day within a specified date range.

Draft Document for Review January 3. Create the date conversion table. Implementing the date conversion method is relatively simple and can be performed in the following four steps: 1. you can join to this table (using either embedded SQL or native Record Level Access operations such as CHAIN) to perform quick and easy date conversions. Create reports. Figure B-12 on page 527 illustrates how the join to the date conversion table works: Figure B-12 Joining files to date conversion table With this technique. ate and time functionality 527 . I can be implemented in any application or tool that has access to DB2 for i. 2010 1:16 pm 7214ax02.fm The result is a very efficient date conversion implementation and a faster-running report. For example: What are the profit margins on days before and after holidays? How many bags of corn chips are sold the week before the Super Bowl? What is the rate of product returns on the day after Christmas as compared to any other day of the year? Are more galoshes sold in the spring or the fall? How many boxes of diapers are sold on days when there is a full moon? The usefulness of a date conversion table goes well beyond DB2 Web Query. Add join segment to the synonym 4. Populate the date conversion table 3. If you have RPG programs. each date format (column) in the date conversion table is available to the DB2 Web Query development tools and therefore can be easily be included in any report. This gives the report developer the ability to effortlessly do some interesting customized analysis. It can even be used in your Query/400 reports. Appendix B. 2.

DC_SEASON CHAR(6) CCSID 37 DEFAULT NULL . Example: B-1 Statement to create the date conversion table CREATE TABLE DATE_CONV ( DC_DATE DATE DEFAULT NULL . DC_CURRENT_MONTH FOR COLUMN DC_CMONTH CHAR(1) CCSID 37 DEFAULT NULL. DC_QUARTER_NAME FOR COLUMN DC_QTR_NAM CHAR(6) CCSID 37 DEFAULT NULL . DC_YYMD_ZONED FOR COLUMN DC_YYMD_Z NUMERIC(8. 0) DEFAULT NULL . DC_DD NUMERIC(2.7214ax02. DC_MONTH_NAME FOR COLUMN DC_MO_NM CHAR(9) CCSID 37 DEFAULT NULL . 0) DEFAULT NULL . 2010 1:16 pm Creating the date conversion table A date conversion table named DATE_CONV is included in the QWQCENT library (which can be downloaded from the Additional Material link in this Redbook’s website. DC_CC NUMERIC(2. DC_DD_CHAR CHAR(2) CCSID 37 DEFAULT NULL . DC_EXCEL_DATE FOR COLUMN DC_EXCEL INTEGER DEFAULT NULL . DC_WEEK_STARTING_DATE FOR COLUMN DC_WKSTR DATE DEFAULT NULL. DC_CURRENT_YEAR FOR COLUMN DC_CYEAR CHAR(1) CCSID 37 DEFAULT NULL. 0) DEFAULT NULL . DC_YYMD_DEC FOR COLUMN DC_YYMD_P DECIMAL(8. DC_JULIAN NUMERIC(7. 528 Getting Started with DB2 Web Query for i . DC_MDYY_CHAR FOR COLUMN DC_MDYY_C CHAR(8) CCSID 37 DEFAULT NULL . DC_CURRENT_QUARTER FOR COLUMN DC_CQTR CHAR(1) CCSID 37 DEFAULT NULL. DC_CURRENT_QUARTER_LAST_YEAR FOR COLUMN DC_LQTR CHAR(1) CCSID 37 DEFAULT NULL. DC_FISCAL_YEAR FOR COLUMN DC_FIS_YR INTEGER DEFAULT NULL . DC_MM NUMERIC(2. DC_WOY INTEGER DEFAULT NULL .) If you are interested. DC_MONTH_ABRV FOR COLUMN DC_MO_ABV CHAR(3) CCSID 37 DEFAULT NULL . DC_CURRENT_DAY FOR COLUMN DC_CDAY CHAR(1) CCSID 37 DEFAULT NULL. DC_DOY INTEGER DEFAULT NULL . DC_QOY INTEGER DEFAULT NULL . DC_YEAR INTEGER DEFAULT NULL . DC_DAY_NAME FOR COLUMN DC_DAY_NAM CHAR(9) CCSID 37 DEFAULT NULL .fm Draft Document for Review January 3. DC_CURRENT_MONTH_LAST_YEAR FOR COLUMN DC_LMONTH CHAR(1) CCSID 37 DEFAULT NULL. DC_CURRENT_WEEK FOR COLUMN DC_CWEEK CHAR(1) CCSID 37 DEFAULT NULL. 0) DEFAULT NULL . DC_FISCAL_QUARTER FOR COLUMN DC_FIS_QTR INTEGER DEFAULT NULL . DC_YYMD_CHAR FOR COLUMN DC_YYMD_C CHAR(8) CCSID 37 DEFAULT NULL . 0) DEFAULT NULL . DC_WEEKEND CHAR(1) CCSID 37 DEFAULT NULL . DC_CYYMMDD DECIMAL(7. 0) DEFAULT NULL . DC_JDE_JULIAN_DATE FOR COLUMN DC_JDE_JUL DECIMAL(6. 0) DEFAULT NULL . DC_WEEK_ENDING_DATE FOR COLUMN DC_WKEND DATE DEFAULT NULL. 0) DEFAULT NULL . 0) DEFAULT NULL . 0) DEFAULT NULL . LABEL ON COLUMN DATE_CONV ( DC_DATE TEXT IS 'Date (date format)' . DC_MDYY_DEC FOR COLUMN DC_MDYY_P DECIMAL(8. DC_CURRENT_DAY_LAST_YEAR FOR COLUMN DC_LDAY CHAR(1) CCSID 37 DEFAULT NULL. DC_MM_CHAR CHAR(2) CCSID 37 DEFAULT NULL . DC_CURRENT_YEAR_LAST_YEAR FOR COLUMN DC_LYEAR CHAR(1) CCSID 37 DEFAULT NULL). DC_SAME_DAY_LAST_YEAR FOR COLUMN DC_SDLY DATE DEFAULT NULL. the SQL statement to create the table is provided in Example B-1. DC_MDYY_ZONED FOR COLUMN DC_MDYY_Z NUMERIC(8. 0) DEFAULT NULL . DC_DOW INTEGER DEFAULT NULL . DC_YY_CHAR CHAR(2) CCSID 37 DEFAULT NULL . DC_CURRENT_WEEK_LAST_YEAR FOR COLUMN DC_LWEEK CHAR(1) CCSID 37 DEFAULT NULL. DC_YY NUMERIC(2. DC_CC_CHAR CHAR(2) CCSID 37 DEFAULT NULL .

DC_WEEK_ENDING_DATE TEXT IS 'Week ending date (the next Friday)'. unless there are columns you want to add or remove.fm DC_JDE_JULIAN_DATE TEXT IS 'JDE Julian Date (CYYDDD decimal)' . DC_DD_CHAR TEXT IS 'Day (2 characters)' . 2030. DC_CURRENT_WEEK TEXT IS 'Current Week (Y/N)'. If you are interested in creating a customized version. DC_MDYY_DEC TEXT IS 'Date (MMDDYYYY packed decimal)' .Draft Document for Review January 3. the SQL stored procedure used to populate this table is provided in Example B-2. DC_SEASON TEXT IS 'Season (Spring. DC_EXCEL_DATE TEXT IS 'Date in Excel format' . Therefore. etc)' . DC_YY TEXT IS 'Year (2 digits)' . DC_YYMD_CHAR TEXT IS 'Date (YYYYMMDD character)' . DC_MDYY_CHAR TEXT IS 'Date (MMDDYYYY character)' . etc)' . DC_MDYY_ZONED TEXT IS 'Date (MMDDYYYY zoned decimal)' .)' . DC_WOY TEXT IS 'Week of year (1-52)' . 1900 and December 31. DC_CURRENT_DAY TEXT IS 'Current Day (Y/N)'. DC_QOY TEXT IS 'Quarter of year (1-4)' . DC_MONTH_NAME TEXT IS 'Month name (January. DC_CURRENT_MONTH TEXT IS 'Current Month (Y/N)'. Autumn. DC_DOW TEXT IS 'Day of week (1-7)' . DC_CURRENT_DAY_LAST_YEAR TEXT IS 'Current Day Last Year (Y/N)'. DC_FISCAL_YEAR TEXT IS 'Fiscal year (4 digits)' . Populating the date conversion table As mentioned previously. DC_JULIAN TEXT IS 'Date in Julian format' . This stored procedure will create one row for every day on and between January 1. DC_DAY_NAME TEXT IS 'Day Name (Monday. DC_WEEK_STARTING_DATE TEXT IS 'Week starting date (the prior Saturday)'. DC_DD TEXT IS 'Day (2 digits)' . DC_MONTH_ABRV TEXT IS 'Month abbreviation (Jan. ate and time functionality 529 . DC_MM TEXT IS 'Month (2 digits)' . DC_CURRENT_QUARTER_LAST_YEAR TEXT IS 'Current Quarter Last Year (Y/N)'. Feb. DC_CURRENT_MONTH_LAST_YEAR TEXT IS 'Current Month Last Year (Y/N)'. DC_YY_CHAR TEXT IS 'Year (2 characters)' . 2010 1:16 pm 7214ax02. DC_FISCAL_QUARTER TEXT IS 'Fiscal quarter (1-4)' . DC_QUARTER_NAME TEXT IS 'Quarter name (2008Q1)' . DC_CURRENT_WEEK_LAST_YEAR TEXT IS 'Current Week Last Year (Y/N)'. DC_CYYMMDD TEXT IS 'CYYMMDD packed C = 0 for 1900 & C = 1 for 2000' . DC_YYMD_ZONED TEXT IS 'Date (YYYYMMDD zoned decimal)' . DC_CURRENT_YEAR_LAST_YEAR TEXT IS 'Current Year Last Year (Y/N)') . DC_DOY TEXT IS 'Day of year (1-366)' . DC_CC_CHAR TEXT IS 'Century (2 characters)' . DC_WEEKEND TEXT IS 'Weekend Flag (Y or N)' .etc. Appendix B. DC_SAME_DAY_LAST_YEAR TEXT IS 'Same day last year'. DC_MM_CHAR TEXT IS 'Month (2 characters)' . DC_CURRENT_YEAR TEXT IS 'Current Year (Y/N)'. DC_YYMD_DEC TEXT IS 'Date (YYYYMMDD packed decimal)' . DC_CURRENT_QUARTER TEXT IS 'Current Quarter (Y/N)'. Winter)' . DC_CC TEXT IS 'Century (2 digits)' . Summer. a pre-popluated date conversion table is included in the QWQCENT database. you can simply use this version of the table. DC_YEAR TEXT IS 'Year (4 digits)' .

VAR_CURRENT_WEEK_LAST_YEAR CHAR(1) . VAR_QOY INTEGER .7214ax02. VAR_DATE_YYMD_CHAR CHAR ( 8 ) . VAR_FISCAL_QUARTER INTEGER . VAR_QUARTER_NAME CHAR ( 6 ) . SET VAR_DATE = '01/01/1900' . VAR_CC NUMERIC ( 2 . VAR_WEEK_ENDING_DATE DATE DEFAULT NULL .fm Draft Document for Review January 3. VAR_WOY INTEGER . VAR_CURRENT_QUARTER CHAR(1) . VAR_WEEK_STARTING_DATE DATE DEFAULT NULL . SET VAR_CURRENT_DAY = 'N' . VAR_YY NUMERIC ( 2 . 530 Getting Started with DB2 Web Query for i . VAR_MONTH_NAME CHAR ( 9 ) . VAR_CYYMMDD_DEC DECIMAL ( 7 . VAR_DATE_YYMD_ZONED NUMERIC( 8 . 0 ) . VAR_CURRENT_YEAR_LAST_YEAR CHAR(1) . VAR_CURRENT_QUARTER_LAST_YEAR CHAR(1) . VAR_DD NUMERIC ( 2 . 0 ) . VAR_SAME_DAY_LAST_YEAR DATE DEFAULT NULL . 0 ) . VAR_EXCEL_DATE INTEGER . VAR_YEAR INTEGER . 0 ) . VAR_DAY_NAME CHAR ( 9 ) . VAR_CURRENT_WEEK CHAR(1) . VAR_DATE_MDYY_ZONED NUMERIC( 8 . 0 ) . VAR_MONTH_ABRV CHAR ( 3 ) . VAR_SEASON CHAR ( 6 ) . 2010 1:16 pm Example: B-2 Stored procedure to load the date conversion table CREATE PROCEDURE LOAD_DATE_CONVERSION_TABLE ( ) LANGUAGE SQL BEGIN DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE VAR_DATE DATE DEFAULT NULL . VAR_JDE_JULIAN_DATE DECIMAL ( 6 . VAR_JULIAN NUMERIC ( 7 . 0 ) . VAR_DATE_MDYY_DEC DECIMAL ( 8 . VAR_DOW INTEGER . VAR_CC_CHAR CHAR ( 2 ) . VAR_DATE_YYMD_DEC DECIMAL ( 8 . VAR_MM_CHAR CHAR ( 2 ) . VAR_MM NUMERIC ( 2 . VAR_YY_CHAR CHAR ( 2 ) . VAR_CURRENT_MONTH CHAR(1) . VAR_CURRENT_DAY_LAST_YEAR CHAR(1) . VAR_DD_CHAR CHAR ( 2 ) . VAR_CURRENT_YEAR CHAR(1) . VAR_FISCAL_YEAR INTEGER . 0 ) . VAR_JDE_JULIAN_DATE_CHAR CHAR ( 6 ) . VAR_WEEKEND CHAR ( 1 ) . 0 ) . 0 ) . VAR_CURRENT_MONTH_LAST_YEAR CHAR(1) . VAR_DATE_MDYY_CHAR CHAR ( 8 ) . VAR_DOY INTEGER . VAR_CURRENT_DAY CHAR(1) . 0 ) . 0 ) . SET VAR_CURRENT_WEEK = 'N' .

SET VAR_YY = DECIMAL ( SUBSTRING ( CHAR ( YEAR ( VAR_DATE ) ) . 1 . -. SET VAR_DOW = DAYOFWEEK_ISO ( VAR_DATE ) . 2 ) . VAR_CURRENT_YEAR = 'N' . SET VAR_MM_CHAR = SUBSTRING(DIGITS(MONTH(VAR_DATE)). 2 ) . 3 . SET VAR_QOY = QUARTER ( VAR_DATE ) . SET VAR_DATE_YYMD_DEC = DECIMAL ( VAR_DATE_YYMD_CHAR ) .2) .9.9. VAR_CURRENT_YEAR_LAST_YEAR = 'N' . SET VAR_DD = DAY ( VAR_DATE ) . SET VAR_JDE_JULIAN_DATE = ( INT ( VAR_DATE . SET VAR_CC_CHAR = SUBSTRING ( CHAR ( YEAR ( VAR_DATE ) ) . VAR_CURRENT_QUARTER_LAST_YEAR = 'N' . ate and time functionality 531 . SET VAR_EXCEL_DATE = ( CASE WHEN VAR_EXCEL_DATE > 59 THEN VAR_EXCEL_DATE + 1 ELSE VAR_EXCEL_DATE END ) . SET VAR_DATE_MDYY_ZONED = VAR_DATE_MDYY_DEC . SET VAR_DD_CHAR = SUBSTRING(DIGITS(DAY(VAR_DATE)). SET VAR_DATE_MDYY_CHAR = VAR_MM_CHAR|| VAR_DD_CHAR || VAR_CC_CHAR || VAR_YY_CHAR . VAR_CURRENT_QUARTER = 'N' .Excel incorrectly calculates Feb 29. 2 ) ) . SET VAR_DATE_YYMD_CHAR = ( VAR_CC * 1000000 ) + ( VAR_YY * 10000 ) + ( VAR_MM * 100 ) + VAR_DD . 1 . SET VAR_DOY = DAYOFYEAR ( VAR_DATE ) . -.DAYS ( DATE ( '01/01/1900' ) ) ) + 1 . SET VAR_EXCEL_DATE = INT ( DAYS ( VAR_DATE ) .fm SET SET SET SET SET SET SET SET VAR_CURRENT_MONTH = 'N' . SET VAR_CYYMMDD_DEC = ( CASE WHEN VAR_CC = 19 THEN ( VAR_YY * 10000 ) + ( VAR_MM * 100 ) + VAR_DD ELSE 1000000 + ( VAR_YY * 10000 ) + ( VAR_MM * 100 ) + VAR_DD END ) . VAR_CURRENT_WEEK_LAST_YEAR = 'N' . SET VAR_WOY = WEEK ( VAR_DATE ) . SET VAR_DATE_MDYY_DEC = DECIMAL ( VAR_DATE_MDYY_CHAR ) .DATE ( '01/01/1900' ) ) / 10000 ) * 1000 + DAYOFYEAR ( VAR_DATE ) . 3 .Draft Document for Review January 3. SET VAR_YY_CHAR = SUBSTRING ( CHAR ( YEAR ( VAR_DATE ) ) . 2 ) ) .The following accounts for that. VAR_CURRENT_DAY_LAST_YEAR = 'N' . REPEAT SET VAR_YEAR = YEAR ( VAR_DATE ) . SET VAR_DATE_YYMD_ZONED = VAR_DATE_YYMD_DEC . VAR_CURRENT_MONTH_LAST_YEAR = 'N' .2) . SET VAR_MM = MONTH ( VAR_DATE ) . 1900 as a leap day (when in fact it is not). 2010 1:16 pm 7214ax02. SET VAR_DAY_NAME = ( CASE VAR_DOW WHEN 1 THEN 'Monday' WHEN 2 Appendix B. SET VAR_CC = DECIMAL ( SUBSTRING ( CHAR ( YEAR ( VAR_DATE ) ) .

7214ax02. SET VAR_FISCAL_YEAR = ( CASE WHEN VAR_MM < 10 THEN YEAR ( VAR_DATE ) ELSE YEAR ( VAR_DATE ) + 1 21 ) 21 ) 21 ) < 21 ) 532 Getting Started with DB2 Web Query for i . 'Tuesday' 'Wednesday' 'Thursday' 'Friday' 'Saturday' 'Sunday' SET VAR_QUARTER_NAME = TRIM ( CHAR ( YEAR ( VAR_DATE ) ) ) CONCAT 'Q' CONCAT TRIM ( CHAR ( QUARTER ( VAR_DATE ) ) ) . SET VAR_SEASON = ( CASE WHEN VAR_MM < 3 OR ( VAR_MM = 3 AND VAR_DD < THEN 'Winter' WHEN VAR_MM < 6 OR ( VAR_MM = 6 AND VAR_DD < THEN 'Spring' WHEN VAR_MM < 9 OR ( VAR_MM = 9 AND VAR_DD < THEN 'Summer' WHEN VAR_MM < 12 OR ( VAR_MM = 12 AND VAR_DD THEN 'Autumn' ELSE 'Winter' END ) . SET VAR_WEEKEND = ( CASE VAR_DOW WHEN 1 THEN 'Y' WHEN 7 THEN 'Y' ELSE 'N' END ) .fm Draft Document for Review January 3. SET VAR_FISCAL_QUARTER = ( CASE WHEN VAR_MM < 4 THEN 2 WHEN VAR_MM < 7 THEN 3 WHEN VAR_MM < 10 THEN 4 ELSE 1 END ) . 2010 1:16 pm THEN WHEN 3 THEN WHEN 4 THEN WHEN 5 THEN WHEN 6 THEN WHEN 7 THEN ELSE '' END ) .

SET VAR_WEEK_STARTING_DATE = VAR_WEEK_ENDING_DATE . SET VAR_WEEK_ENDING_DATE = ( CASE VAR_DOW WHEN 1 THEN VAR_DATE + 4 DAYS WHEN 2 THEN VAR_DATE + 3 DAYS WHEN 3 THEN VAR_DATE + 2 DAYS WHEN 4 THEN VAR_DATE + 1 DAYS WHEN 5 THEN VAR_DATE WHEN 6 THEN VAR_DATE + 6 DAYS WHEN 7 THEN VAR_DATE + 5 DAYS ELSE NULL END ) . 1 . SET VAR_JULIAN = DECIMAL ( SUBSTRING ( CHAR ( ( YEAR ( VAR_DATE ) * 1000 + DAYOFYEAR ( VAR_DATE ) ) ) . 7 ) ) . Appendix B. 2010 1:16 pm 7214ax02. SET VAR_MONTH_ABRV = ( CASE VAR_MM WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' ELSE '' END ) .6 DAYS. SET VAR_MONTH_NAME = MONTHNAME ( VAR_DATE ) .Draft Document for Review January 3. ate and time functionality 533 .fm END ) .

VAR_CC . VAR_EXCEL_DATE . VAR_SEASON . 534 Getting Started with DB2 Web Query for i . VAR_CURRENT_QUARTER_LAST_YEAR. VAR_DOY . VAR_MM_CHAR . VAR_CURRENT_QUARTER. VAR_YY . VAR_QUARTER_NAME . VAR_DAY_NAME . VAR_DATE_MDYY_CHAR . VAR_CC_CHAR . VAR_DD . 2010 1:16 pm SET VAR_SAME_DAY_LAST_YEAR = VAR_DATE . VAR_CURRENT_YEAR_LAST_YEAR ) . VAR_CURRENT_WEEK. VAR_CURRENT_YEAR. VAR_SAME_DAY_LAST_YEAR. VAR_CURRENT_MONTH_LAST_YEAR. VAR_FISCAL_YEAR . VAR_MM . VAR_DATE_YYMD_ZONED . VAR_WEEKEND . VAR_DATE_YYMD_DEC . VAR_YY_CHAR . VAR_CURRENT_DAY_LAST_YEAR. VAR_CURRENT_MONTH. VAR_DOW . VAR_WOY . VAR_WEEK_STARTING_DATE. SET VAR_DATE = VAR_DATE + 1 DAY . VAR_WEEK_ENDING_DATE. VAR_MONTH_NAME . UNTIL VAR_DATE > '12/31/2030' END REPEAT . VAR_CURRENT_DAY. VAR_DATE_MDYY_ZONED . VAR_CYYMMDD_DEC .364 DAYS. VAR_DATE_MDYY_DEC . VAR_JDE_JULIAN_DATE . VAR_JULIAN . VAR_YEAR . END . VAR_CURRENT_WEEK_LAST_YEAR.fm Draft Document for Review January 3.7214ax02. VAR_DATE_YYMD_CHAR . VAR_MONTH_ABRV . VAR_QOY . INSERT INTO DATE_CONV VALUES ( VAR_DATE . VAR_DD_CHAR . VAR_FISCAL_QUARTER .

UPDATE DATE_CONV SET DC_CURRENT_QUARTER = 'Y' WHERE DC_YEAR = YEAR(CURRENT DATE) AND DC_QOY = QUARTER(CURRENT DATE).1). 2010 1:16 pm 7214ax02.1) AND DC_QOY = QUARTER(CURRENT DATE). For example. The stored procedure example provided in Example B-3 does just that. Example: B-3 Stored procedure to update the columns of current flags CREATE PROCEDURE UPDATE_DATE_CONVERSION_TABLE ( ) LANGUAGE SQL BEGIN UPDATE UPDATE UPDATE UPDATE UPDATE DATE_CONV DATE_CONV DATE_CONV DATE_CONV DATE_CONV SET SET SET SET SET DC_CURRENT_DAY = 'N' WHERE DC_CURRENT_DAY = 'Y'. UPDATE DATE_CONV SET DC_CURRENT_WEEK = 'Y' WHERE DC_DATE >= (SELECT DC_WEEK_STARTING_DATE FROM DATE_CONV WHERE DC_DATE = CURRENT DATE) AND DC_DATE <= (SELECT DC_WEEK_ENDING_DATE FROM DATE_CONV WHERE DC_DATE = CURRENT DATE). ate and time functionality 535 . UPDATE DATE_CONV SET DC_CURRENT_YEAR_LAST_YEAR = 'Y' WHERE DC_YEAR = (YEAR(CURRENT DATE) . UPDATE DATE_CONV SET DC_CURRENT_QUARTER_LAST_YEAR = 'N' WHERE DC_CURRENT_QUARTER_LAST_YEAR = 'Y'. END. UPDATE DATE_CONV SET DC_CURRENT_DAY_LAST_YEAR = 'Y' WHERE DC_DATE = CURRENT DATE . DC_CURRENT_MONTH = 'N' WHERE DC_CURRENT_MONTH = 'Y'.364 DAYS)). Appendix B. UPDATE DATE_CONV SET DC_CURRENT_MONTH_LAST_YEAR = 'N' WHERE DC_CURRENT_MONTH_LAST_YEAR = 'Y'. UPDATE DATE_CONV SET DC_CURRENT_MONTH_LAST_YEAR = 'Y' WHERE DC_YEAR = (YEAR(CURRENT DATE) . then the value for the DC_CURRENT_YEAR column would be ‘Y’ for all of the rows that represent dates for the year 2009. 2009.364 DAYS. UPDATE DATE_CONV SET DC_CURRENT_MONTH = 'Y' WHERE DC_YEAR = YEAR(CURRENT DATE) AND DC_MM = MONTH(CURRENT DATE).Draft Document for Review January 3. the column DC_CURRENT_YEAR will contain a ‘Y’ if that row represents a date whose year is equal to the current year. Because these are dynamic values. UPDATE DATE_CONV SET DC_CURRENT_DAY_LAST_YEAR = 'N' WHERE DC_CURRENT_DAY_LAST_YEAR = 'Y'.364 DAYS)) AND DC_DATE <= (SELECT DC_WEEK_ENDING_DATE FROM DATE_CONV WHERE DC_DATE = (CURRENT DATE . DC_CURRENT_QUARTER = 'N' WHERE DC_CURRENT_QUARTER = 'Y'. UPDATE DATE_CONV SET DC_CURRENT_QUARTER_LAST_YEAR = 'Y' WHERE DC_YEAR = (YEAR(CURRENT DATE) . So if the current date is August 26. UPDATE DATE_CONV SET DC_CURRENT_WEEK_LAST_YEAR = 'N' WHERE DC_CURRENT_WEEK_LAST_YEAR = 'Y'.1) AND DC_MM = MONTH(CURRENT DATE). UPDATE DATE_CONV SET DC_CURRENT_WEEK_LAST_YEAR = 'Y' WHERE DC_DATE >= (SELECT DC_WEEK_STARTING_DATE FROM DATE_CONV WHERE DC_DATE = (CURRENT DATE . DC_CURRENT_YEAR = 'N' WHERE DC_CURRENT_YEAR = 'Y'.fm Notice that several of the columns in the date conversion table are “current” flags that contain the value of ‘Y’ or ‘N’ depending of if the condition for that flag is met. UPDATE DATE_CONV SET DC_CURRENT_YEAR = 'Y' WHERE DC_YEAR = YEAR(CURRENT DATE). DC_CURRENT_WEEK = 'N' WHERE DC_CURRENT_WEEK = 'Y'. you need to add a process to keep these columns in the date conversion table updated. UPDATE DATE_CONV SET DC_CURRENT_YEAR_LAST_YEAR = 'N' WHERE DC_CURRENT_YEAR_LAST_YEAR = 'Y'. UPDATE DATE_CONV SET DC_CURRENT_DAY = 'Y' WHERE DC_DATE = CURRENT DATE.

Adding join segments to the synonym As described earlier. 1. This can be accomplished by taking the following steps: 1. Now add a job sheduler job to run the SQL script in the source file member: ADDJOBJS JOB(UPDDATCONV) SCDCDE(*DAILY) TIME(0010) CMD(RUNSQLSTM SRCFILE(QGPL/QTXTSRC) SRCMBR(UPDDATCONV) COMMIT(*NONE) NAMING(*SYS)) This job scheduler job will run daily at 1 AM and will call the RUNSQLSTM command to run the script (in the specified source file member) through SQL. you likely do not have the latest version of this library. Right mouse click on this file and select Edit in Synonym Editor as shown in Figure B-13 on page 537. 536 Getting Started with DB2 Web Query for i . For this example. Attention: If you can not find the tables DATE_CONV or LEGACY_ORDER_HEADER in the QWQCENT library. It can be downloaded from the Additonal Materials link of this redbook. In general. you will use the table in library QWQCENT named LEGACY_ORDER_HEADER (the 10 character system name is ORDHDR).mas file under Data Servers → EDASERVE → Applications → baseapp 4. Each report and graph that uses the synonym will be able to use the join segment (and not have to redefine it). Find the cen_legacy_order_header. To do this.fm Draft Document for Review January 3. Open DB2 Web Query Developer Workbench and open a connection to your environment 3. Give it a a prefix of cen_ 2. Create a source file member to store an SQL statement script ADDPFM FILE(QGPL/QTXTSRC) MBR(UPDDATCONV) 2. it is advantageous to define the joins in the synonym (rather than individual reports and graphs) for the simple reason that this piece of logic is centralized in one location. 2010 1:16 pm All you need to do is make sure this stored procedure runs every day. Create a DB2 Web Query synonym over the DATE_CONV table. there are several ways that the date conversion table can be joined to the legacy file.7214ax02. create a job scheduler entry to call this stored procedure daily. This section describes how to implement the join in the DB2 Web Query synonym. Edit this source file member and add the following SQL statement to call the stored procedure: CALL QWQCENT/UPDATE_DATE_CONVERSION_TABLE 3.

5. 6.fm Figure B-13 Edit cen_legacy_order_header At this point you want to add a join segment to the date conversion table.Draft Document for Review January 3. 2010 1:16 pm 7214ax02. find and select the cen_date_conv synonym and press the Select button Appendix B. As demonstrated in Figure B-15 on page 538. ate and time functionality 537 . Right-mouse click on the CEN_LEGAGY_ORDER_HEADER segment name and select Add → Segment From Existing Synonym as shown in Figure B-14 Figure B-14 Add join segment to legacy_orders_table A list of synonyms in the BASEAPP folder is presented.

7. This is a drop down list. 2010 1:16 pm Figure B-15 Select cen_date_conv synonym The new segement is added to the synonym.7214ax02. Click on it to and change the Type to Unique as shown in Figure B-16 on page 539. This will instruct DB2 Web Query to rely on SQL syntax to create the join and when accessing the joined columns (allowing you to sort and select fields across multiple join segments) 538 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. Select the new CEN_DATE_CONV join segment and locate the Type attribute under SEGTYPE 8. Next you need to change the segment type from Multiple to Unique.

2010 1:16 pm 7214ax02. ate and time functionality 539 . Appendix B. As shown in Figure B-17.Draft Document for Review January 3.fm Figure B-16 Change segtment type to Unique 9. right-click again on the CEN_DATE_CONV segment and select Join Properties. Next define the fields that will be used to join the tables together.

do the following: – From the list of columns in the CEN_LEGACY_ORDER_HEADER segment. 2010 1:16 pm Figure B-17 Select Join Properties 10.7214ax02. This action should bring the selected join columns down into the expression pane. select ORDDAT so that it is highlighted.fm Draft Document for Review January 3. The values in the ORDDAT are in this format. – Click the = icon located between the two segment lists. thus this is the column in the date conversion table that you want to use as the join column.In the Join Properties window. 540 Getting Started with DB2 Web Query for i . An example is shown in Figure B-18. select DC_MDYY_DEC so that it is highlighted. – From the list of columns in the CEN_DATE_CONV segment.

If you do not do this. That is really going the extra mile.Highlight the segment and select Rename from the right mouse click menu.fm Figure B-18 Define join columns 11. This is shown in Figure B-19. the segment names to the date conversion table many be ambiguous (your’re report developers may not be certain what legacy date field they represent).Draft Document for Review January 3. Appendix B. 12. Tip: If you are very meticulous (and ambitious). This can be done by highlighting the column and selecting Rename from the right-click menu. ate and time functionality 541 .Click OK To help the report developers identify what legacy date field this date conversion segment represents. but you’re report developers would love you for this. 2010 1:16 pm 7214ax02. rename the segment to the name of the field it is converting. you could even completely remove the ambiguity by renaming each of the individual column names in the date conversion segments (for example rename DC_YEAR to ORDDAT_YEAR). you will need to define a join segment to date_conv for each one. This is particularly true if you have multiple legacy date fields in your synonym because to convert them.

7214ax02. 2010 1:16 pm Figure B-19 Reame the segment 13.fm Draft Document for Review January 3.Specify ORDDAT as the segment name. 542 Getting Started with DB2 Web Query for i . When you are finished. your synonym will look like the example provided in Figure B-20.

2010 1:16 pm 7214ax02. Be sure you rename the segment SHPDAT.fm Figure B-20 Synonym with new ORDDAT segment 14.Repeat steps 5-13 for the SHPDAT legacy date field field. Author Comment: I was not able to figure out how to create a cross reference for “steps 5-13” above.Close the Edit synonym window Appendix B. ate and time functionality 543 . 15.Draft Document for Review January 3.Save the synonym 16.

Select the CEN_LEGACY_ORDER_HEADER synonym as the report data source. CREATE INDEX DATE_CONV_INDEX_00001 ON DATE_CONV (DC_MDYY_DEC ASC). Create a new report in Tutorials using Report Assistant 3.fm Draft Document for Review January 3. The list is now long and cluttered. Return to your DB2 Web Query browser session. Here are the two SQL statements for creating indexes over the LEGACY_ORDER_HEADER and DATE_CONV tables: CREATE INDEX LEGACY_ORDER_HEADER_INDEX_00001 ON LEGACY_ORDER_HEADER (ORDDAT ASC). 2010 1:16 pm Tip: For performance reasons. Notice that all of the columns from the date conversion table now appear in the list of fields to choose from. The DB2 optimizer will be able to use these indexes for statistics and implementation during query execution. Follow these steps: 1. 2.7214ax02. Creating reports using the date conversion table Once the join has been defined in the synonym. Figure B-21 Display Tree view 544 Getting Started with DB2 Web Query for i . The Report Assisant tool is presented. To organize it better. the next step is to create a report over this updated synonym. now would be a good time to create indexes over your join columns. click the Tree icon as shown in Figure B-21 so that the list is organized into a Tree view.

e. and allows you to expand and collapse the list of columns under each segment. taking this action groups the synonym columns under their respective segments. the report definition should look like the exampe provided in Figure B-23 on page 546.Draft Document for Review January 3. Drag DC_DAY_OF_WEEK field into the Sort across pane. You really want to sort by this field and not by the name of the day of the week field (DC_DAY_NAME).fm As shown in Figure B-22 on page 545. Otherwise the data for Friday would appear first (since it's the first day name alphabetically) and Wednesday would appear last. Drag DC_DOW field into the Sort across pane. Click on the Show field options icon for this field. Add comma inclusion and floating currency formatting to the ORDAMT field by adding CM to the end of the Format in report as setting. Drag the ORDAMT field into the Sum pane and select it. When finished. d. 2010 1:16 pm 7214ax02. DC_DOW is the numeric value of the day of the week. b. Drag the new DC_YEAR field into the Sort by pane. c. ate and time functionality 545 . However you probably don't want the numeric day of the week value to actually appear on the report. So you want to hide this column in the report. Figure B-22 Example of Tree View 4. Appendix B. Finish the report by performing the following: a. Make it an invisible field.

7214ax02.fm Draft Document for Review January 3. Run the report. Figure B-24 Results of report using date conversion table Other than the fields and techniques used for date conversion. They should be identical. The results should look identical to those in Figure B-24. 546 Getting Started with DB2 Web Query for i . Compare the results of those two reports. 2010 1:16 pm Figure B-23 Report using date conversion table 5. Save your report as “Date conversion using date conversion table”. 6. this is the same report that you created in “Using DB2 Web Query functions to convert to dates” on page 521.

Why is this a disadvantage? Because there may many columns in the table and some of them may never actually be used in the reports. If they are needed for some reports you can simply “unhide” them by unchecking the INTERNAL setting. and as mentioned previously. This will add even more columns to the list of fields in the development tools. while not showing them in the development tools. Here are some ideas to keep the list of available fields to a manageable size: Create date conversion table with fewer columns (only the ones your use regularly) Create DB2 Web Query business views over your synonyms. if you have multiple legacy date fields in your file and you want to convert them to date fields. particularly if the synonym contains many other columns. See zzz for more information on business views. This gives report developers the ability to easily and effortlessly include a wide variety of date formats in your reports. This will allow you to create and organize a subset of columns to display in the report development tools. These columns can clutter up the list.Draft Document for Review January 3. Figure B-25 on page 548 provides an example of how to hide DC_MONTH_NAME so that it does not appear in the list of available columns in the report development tools. Set the the column’s Access Property to INTERNAL to hide the infrequently used columns in the synonym . This gives you the ability to preserve the columns in the date conversion table.fm Tip: Now would be an opportune time to create indexes over the join columns. Appendix B. One of the advantages of the date conversion table method is that all of the columns in the table will be brought into the synonyms segment and subsequently will appear on the list of available fields in the development tools. 2010 1:16 pm 7214ax02. One of the disadvantages is that all of the columns in the table will appear on the list of available fields in the development tools. Further. ate and time functionality 547 . you will need to create join segments to the date conversion table for each one.

you will need to edit the synonym and remove (uncheck) the INTERNAL setting for ACCESS PROPERTY. 2010 1:16 pm Figure B-25 Defining a column that does not appear in list of available columns Attention: Existing reports that reference hidden columns (those whose INTERNAL setting for ACCESS PROPERTY is selected) will continue to run. SQL functions such as DATE. YEAR. named ORDER_HEADER_VIEW is shown in Example B-4. In some cases. this may result in a SELECT statement that is somewhat lengthy. But you can hide this complexity from your report developers by creating an SQL view over this statement and then a DB2 Web Query synonym over the view. if you attempt to open such a report in the report development tools. However.fm Draft Document for Review January 3. In those cases.7214ax02. Depending on the legacy date data type and format. An example SQL view that uses multiple SQL functions for date conversions (over the LEGACY_ORDER_HEADER table) is provided in the QWQCENT library. 548 Getting Started with DB2 Web Query for i . Example: B-4 ORDER_HEADER_VIEW definition CREATE VIEW ORDER_HEADER_VIEW AS WITH t1 ( order . This view. the request will fail with a Field not found in master file error. Using SQL Views and functions to convert to dates A third technique for performing date conversions is to leverage the power of SQL functions and reference them in SQL views. and DAYOFWEEK can be used in an SQL SELECT statement to efficiently perform the conversions. it may be necessary to use other functions such as DIGITS and SUBSTRING.

2) || '-' || SUBSTRING(DIGITS(orddat). totlin. DAYOFWEEK_ISO(orderdate) AS orderdow.1. Creates a third derived column named ORDERDOW by referencing the derived column ORDERDATE in the SQL function DAYOFWEEK_ISO. Creates a second derived column named ORDERYEAR by referencing the derived column ORDERDATE in the SQL function YEAR.fm cust . totlin . If you are not familiar with common table expressions.5.2)). shpvia. This column returns the integer value of the day of the week. Appendix B. a common table expression is used. shpvia . shpvia. totlin. invnum ) AS (SELECT order. By using them. This column returns the year portion of the date. invnum FROM legacy_order_header ) SELECT order. you can define a result table with a table-identifier (T1 above) that can be specified as the table name in any FROM clause of the SELECT statement. invnum FROM t1 The above example performs the following: Converts legacy date fields ORDDAT and SHPDAT to true dates and returns them in the derived columns named ORDERDATE AND SHIPDATE.Draft Document for Review January 3. It allows you to define ORDERDATE in one place and reduce the query's complexity by minimizing the amount of text. shipdate. cust.2)).3. DATE(SUBSTRING(DIGITS(orddat). orderdate .1. orderdate. ordamt . 2010 1:16 pm 7214ax02.2) || '-' || SUBSTRING(DIGITS(shpdat).3. ordamt. DATE(SUBSTRING(DIGITS(shpdat). ordsts . shipdate . CASE WHEN DAYOFWEEK_ISO(orderdate) = 1 THEN 'MON' WHEN DAYOFWEEK_ISO(orderdate) = 2 THEN 'TUE' WHEN DAYOFWEEK_ISO(orderdate) = 3 THEN 'WED' WHEN DAYOFWEEK_ISO(orderdate) = 4 THEN 'THU' WHEN DAYOFWEEK_ISO(orderdate) = 5 THEN 'FRI' WHEN DAYOFWEEK_ISO(orderdate) = 6 THEN 'SAT' WHEN DAYOFWEEK_ISO(orderdate) = 7 THEN 'SUN' ELSE '' END AS orderdayname. cust. Creates a fourth derived column named ORDERDAYNAME by referencing the derived column ORDERDATE in the SQL function DAYOFWEEK_ISO and performing some logic in a CASE statement to return the name of the day of the week. Notice the use of the WITH keyword to create an SQL common table expressions. they can be thought of as temporary views that only exist during the execution of the query. ordsts.4) || '-' || SUBSTRING(DIGITS(orddat). ate and time functionality 549 .4) || '-' || SUBSTRING(DIGITS(shpdat). Because the example uses derived columns that reference other derived columns (ORDERDATE). ordsts.5. ordamt. especially when ORDERDATE is referenced multiple times in the query. YEAR(orderdate) AS orderyear.

Drag the ORDAMT field into the Sum pane and select it. It should look like the example provided in Figure B-27 on page 551. 3. Create a new report in Report Assistant. d. e. b. Add comma inclusion and floating currency formatting to the ORDAMT field by adding CM to the end of the Format in report as setting. Create a DB2 Web Query synonym over the view. the report definition should look like the exampe provided in Figure B-26 Figure B-26 Report using SQL view for date conversions 4. Drag ORDERDAYNAME field into the Sort across pane. 550 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3. 2. When finished. using the new view synonym. Specify cen_ for the metadata prefix.7214ax02. Drag ORDERDOW field into the Sort across pane. Click on the Show field options icon for this field. 2010 1:16 pm To create the same type of report (as the previous examples) that uses this SQL view. Similar to the report in the previous section. take the following steps: 1. make it an invisible field so that the columns are sorted by the numeric value of the day of the week rather than alphabetically by the name of the day of the week. Drag the ORDERYEAR field into the Sort by pane. Run the report. a. c.

2010 1:16 pm 7214ax02. and the number of columns converted. ate and time functionality 551 . while the other is actually performing the conversions dynamically. Save your report as “Date conversion using SQL view”. Each version of the report was run 20 times and the run time (the time between when the user selected the report and when the report was displayed to the browser) was recorded and averaged.2 seconds The reason that the date conversion table and SQL views perform so much better (than the DB2 Web Query BIF’s) is because the conversion logic processing is pushed down to the DB2 engine. the answer is "yes. But to give you some idea of what gains can potentially be realized. available indexes. All three methods will provide reliable date conversion results. on the other hand. As you can see in the above benchmarks results. you may be wondering "Does it matter what date conversion technique I implement?" From a functional standpoint. performing the conversion in an SQL views and functions may require a fairly elaborate view defintion and does require some degree of SQL knowledge to implement." Pushing the date conversion logic down to the database engine does provide significant report performance advantages. a mini-benchmark was conducted to compare the performance results of the two techniques. However.9 seconds 5. these are two vastly different approaches: one is performing database joins to locate the row with the data that is already converted. the answer is "No". from a report performance perspective. The DB2 Web Query reports used were essentially identical to the two that you created in the above date conversion exercise. system activity. both have the ability to cache the results so that subsequent requests perform better. can be implemented by someone with limited SQL skills. but exactly to what degree will always vary.000 row ORDERS table. However. The benchmark used a 600. the date dimension table performed slightly better. The results are displayed in the table below: Table B-6 Date conversion technique DB2 Web Query functions (BIFs) Date conversion table SQL functions in an SQL view Average run time (20 executions) 41.6 seconds 3.Draft Document for Review January 3. If SQE processes the requests. depending on such factors as system resources. particularly as more conversion functions were added to the SQL view. The date conversion table. Appendix B. the number of rows retrieved. In addition. Comparing the date conversion techniques So at this point.fm Figure B-27 Results of report using SQL view for date conversions 5.

particularly those used for date conversion.Represents the number of the day of the year. 2009 the full value for this field is 109239 and for August 27. 1999 it is 009239. its easier for many to conceptualize. For August 27. use one of the following (assume that the JDE World file is F43090 and the date field is PCCEFJ DB2 Web Query BIF Use the following expression (where PCCEFJ is the World date field): DATECVT (((GREGDT (PCCEFJ . To convert this field to a true DB2 Web Query date. YY . Use of the BIFs may provide acceptable performance in your environment. Consequently many JD Edwards World customers that use DB2 Web Query need to know how to handle this specific type of date conversion. Attention: The IBM and Information Builders development teams are working on ways to improve the performance of the DB2 Web Query built-in functions. If the performance is not satistfactory.Represents the century indicator: 0 for any date prior to January . the suggested approach is to try using the DB2 Web Query BIF’s first. The goal is to pass as much of that logic to the database engine as possbile. DB2 Web Query’s ability to internally translate the BIF to the appropriate SQL function would provide the best of both worlds: report developers could use the BIF’s for date conversions and deliver a report that performs well. most report developers would probably prefer to use the DB2 Web Query BIF’s. counting from January 1.though one could add syntax to the view to join it with another table that has this information). Converting date fields in Oracle’s JD Edwards World application Oracle’s JD Edwards® World application has very large install base on the IBM i platform. And after all. Date fields in World are typically defined as ZONED (6. Implementing customized columns like fiscal year/quarter and a Super Bowl Sunday flag is also easy because you can manually set these values in the table and view the data. Consequently. 552 Getting Started with DB2 Web Query for i . For simplicity. So for August 27.7214ax02. Dates for the year 2009 would be stored as 09 DDD . most people would likely find the date conversion table method to be a bit more flexible and easier to implement.0) and are in the format CYYDDD broken down as follows: C . 2009. 'MDY') An example is shown in Figure B-28 on page 553. these digits would contain the value 239. 2010 1:16 pm Performance notwithstanding.Represents the two digit year. particularly for smaller databases. The database for this system stores dates in a specific non-standard format. the best technique is purely subjective. 2000 and 1 for any date on or after January 1. Because the information resides in a table that can be viewed and maintained. When deciding between the date conversion table or SQL function/view method. 2000. 'I8YYMD'.fm Draft Document for Review January 3. then consider using one of the other two technques. there is no SUPERBOWLSUNDAY SQL function (not yet anyway . 'I8')) + 19000000).

create a join from the World file to the date conversion table using the World date field (in this case PCCEFJ) and DC_JDE_JULIAN_DATE as the join columns. ate and time functionality 553 . Figure B-29 Using date conversion table to convert JDE World date Appendix B. 2010 1:16 pm 7214ax02. Figure B-29 shows an example of how to define this join in the DB2 Web Query synonym.fm Figure B-28 Converting JDE World date Date conversion table To implement the date conversion table method for JDE World date fields.Draft Document for Review January 3.

7 .0) MDYY 08312009 DATECVT( ZN_MDYY.0) MDYY 08312009 DATECVT( PK_MDYY.7.5.2) ) DATE(SUBSTR(CHAR(ZN_JUL). Some of the more common ones and how to convert them (for each of the three techniques) are are provided in Table B-7.5. 'MDYY' ) Join CH_YYMD to DC_YYMD_CHAR in DATE_CONV table Join ZN_MDYY to DC_MDYY_ZONED in DATE_CONV table DATE(SUBSTRING(CH_YYMD.1.5.1.1.0) (2.2) ) DATE(SUBSTRING(DIGITS(pk_yymd) .2) || '-' || SUBSTRING(DIGITS(PK_MDYY). 2009) ‘08312009’ DB2 Web Query BIF Expression Date conversion table SQL function CH_MDYY CHAR(8) MDYY DATECVT(CH_MDYY. 'P8YYMD'.0) YYMD 20090831 DATECVT( ZN_YYMD.2)|| '-' || SUBSTRING(CH_MDYY.2) ) DATE(SUBSTRING(DIGITS(PK_MDYY) .0) YYMD 20090831 DATECVT( PK_YYMD. 'I8YYMD'. 'I8YYMD' ) Join ZN_JUL to DC_JULIAN in DATE_CONV table Join legacy date fields to the following columns in DATE_CONV table: DC_CC DC_YY DC_MM DC_DD ZN_CEN ZN_YEAR ZN_MONTH ZN_DAY (Each component of the date is stored in a separate zoned decimal field.4) || '-' || SUBSTRING(DIGITS(ZN_MDYY). 'MDYY' ) Join PK_YYMD to DC_YYMD_DEC in DATE_CONV table ZN_JUL ZONED (7. 'A8YYMD'.0) (2.2) || '-' || SUBSTRING(DIGITS(pk_yymd). Table B-7 Legacy date conversion table.) ZONED ZONED ZONED ZONED (2.1.2) || '-' || SUBSTRING(DIGITS(ZN_YYMD).4) || '-' || SUBSTRING(DIGITS(pk_yymd).3.7)) ZN_MDYY ZONED (8. use something like the following to convert the field to a date: SELECT DATE(DIGITS( DECIMAL(pccefj + 1900000 .5.4) || '-' || SUBSTRING(CH_MDYY.7.7214ax02.2) || '-' || SUBSTRING(DIGITS(ZN_MDYY). 2010 1:16 pm SQL functions/view If you prefer the SQL functions and view technique.2)) CH_YYMD CHAR(8) YYMD ‘20090831’ DATECVT( CH_YYMD.4) || '-' || SUBSTRING(DIGITS(ZN_YYMD).0) YYDDD Julian Date CC YY MM DD 2009243 GREGDT( ZN_JUL. 'YYMD' ) DATE(DIGITS(ZN_CEN) || DIGITS(ZN_YEAR) || '-' || DIGITS(ZN_MONTH)|| '-' || DIGITS(ZN_DAY)) 554 Getting Started with DB2 Web Query for i .1.2)) DATE(SUBSTRING(DIGITS(ZN_MDYY) . 'MDYY' ) Join PK_MDYY to DC_MDYY_DEC in DATE_CONV table PK_YYMD PACKED (8. 'MDYY' ) Join ZN_YYMD to DC_YYMD_ZONED in DATE_CONV table PK_MDYY PACKED (8.5.4) || '-' || SUBSTRING(DIGITS(PK_MDYY).3.0) (2.0))) AS conv_date FROM f43090 Converting other common legacy date formats IBM i customers have represented their date fields in many different formats over the years.4) || '-' || SUBSTRING(CH_YYMD. 'I8YYMD'.0) 20 09 08 31 DATECVT( ((ZN_CEN * 1000000) + (ZN_YEAR * 10000) + (ZN_MONTH * 100) + ZN_DAY). 'MDYY') Join CH_MDYY to DC_MDYY_CHAR in DATE_CONV table DATE(SUBSTRING(CH_MDYY. 'MDYY' ) ZN_YYMD ZONED (8. Example legacy date field name Legacy data type Legacy date Format Legacy example (August 31.1.3.fm Draft Document for Review January 3.1.2) ) DATE(SUBSTRING(DIGITS(ZN_YYMD) . 'I8MDYY'.2)|| '-' || SUBSTRING(CH_YYMD. 'A8MDYY'.7. 'P8MDYY'.5.

These functions are described in more detail in the help text included with Developer Workbench. months. a business day and a weekday are the same concept. DATEADD: Adding or subtracting a date unit to or from a date You can add or subtract years. Appendix B. we present a few of the more common DB2 Web Query built-in functions that you can do with dates. To add days. To add months. increment) Figure B-30 demonstrates adding 11 business days (‘BD’) to the order date to calculate the ship date. 2010 1:16 pm 7214ax02. Business days can take a holiday file as input. ate and time functionality 555 . 'A8YYMD'. or JUL. we replace the DATEADD with the following values: ORDERDATE + 11 This creates a SHIPDATE of 11 days in the future. your result field must contain days. ‘Y/M/D/WD/BD’. Figure B-30 DATEADD The DATEADD function is not required if you simply want to add months or days to a date. for example. 2009) 20 09 08 31 DB2 Web Query BIF Expression Date conversion table SQL function CH_CEN CH_YEAR CH_MONTH CH_DAY (Each component of the date is stored in a separate character field. 'YYMD' ) Join legacy date fields to the following columns in DATE_CONV table: DC_CC_CHAR DC_YY_CHAR DC_MM_CHAR DC_DD_CHAR DATE(CH_CEN || CH_YEAR || ‘-’ || CH_MONTH|| ‘-’ || CH_DAY) DB2 Web Query date built-in functions In this section.) CHAR(2) CHAR(2) CHAR(2) CHAR(2) CC YY MM DD DATECVT( (CH_CEN || CHYEAR || CH_MONTH || CH_DAY). your result field must be in a format similar to ‘YYM’ or ‘MY’. If we want to add 11 days to SHIPDATE in the previous example and do not need to worry about business or weekdays. the date field must have a format like YYMD. MDY. YYMD. In the following function. weekdays.Draft Document for Review January 3. days.fm Example legacy date field name Legacy data type Legacy date Format Legacy example (August 31. DATEADD(date. Increment must be an integer. or business days from your date. By default.

SHIPDATE The resulting value is based on the least significant component in the order and ship dates. Table B-8 Values for move-point Move-point EOM BOM EOQ BOQ EOY BOY EOW BOW NWD NBD PWD PBD WDMeaning End of month Beginning of month End of quarter Beginning of quarter End of year Beginning of year End of week Beginning of week Next weekday Next business day Prior weekday Prior business day Current weekday or prior weekday (if weekend) 556 Getting Started with DB2 Web Query for i . date2. date2. You can simply code a statement like the following example: ORDERDATE . MDYY or YYJUL. months. the DATEDIFF function allows you to find the difference between two dates in terms of years.fm Draft Document for Review January 3. For example. If both dates are defined down to the day level. you do not need to use DATEDIFF. DATEMOV(date. for example. Table B-8 lists the possible values for move-point. If you only want to find the difference in months or days. ‘move-point’) The date field must be a full date. days. Figure B-31 DATEDIFF DATEMOV: Moving the date to a significant point DATEMOV moves your date field to a significant point such as the end of the week or the beginning or the quarter. and business days. then your results are in months. if one of the dates is defined as YYM. The result field from DATEDIFF should be defined as an I8 field (Figure B-31): DATEDIFF(date1. or both can be fields or constants. for example ‘20070101’. weekdays.7214ax02. 2010 1:16 pm DATEDIFF: Calculating the difference between two dates Similar to DATEADD. then your results are in days. ‘Y/M/D/WD/BD’) Date1.

Create a new report using Report Assistant and select cen_orders at the data source. 2. 'I8YYMD'. 2007 and December 22. Create a DEFINE field named inDate2.The specified number of days after the input date The report will then return rows in which the order date within is the specified date range. The format is YYMD and the expression is DATECVT(&inDate. if the user entered 200071212 for the date and 10 for the number of days. For example. Appendix B. ate and time functionality 557 . the report would return rows on or between December 2. This is an example of an implicit input parameter.fm Move-point BDWD+ BD+ Meaning Current business day or prior business day if current is a non-business day Current weekday or next weekday (if weekend) Current business day or next business day if current is a non-business day Example: Dynamic Date Range report In this section you create a report that gives the end user the ability to select a dynamic range of rows based on two input parameters: an input date and number of days. take the following steps: 1. 'YYMD').Draft Document for Review January 3. An example is shown in Figure B-32. 2010 1:16 pm 7214ax02. 2007. The report will calculate a date range based on the two input fields. The date range is defined as follows: beginRange .The specified number of days before the input date endRange . Figure B-32 DEFINE field for inDate2 This define field will automatically create the prompt for an input parameter named &inDate (when the report is run). To create this report. It will then convert the input parameter to a true date field.

(0-&daysRange)) as shown in Figure B-33. Create a DEFINE field named beginRange. The DEFINE field will return a date that is the specified number of days less than the specified input date. 'D'.7214ax02. Figure B-33 DEFINE field beginRange Similar to above. you do not create an explicit input parameter for &daysRange. 3.fm Draft Document for Review January 3. &daysRange) as shown in Figure B-34 on page 559 558 Getting Started with DB2 Web Query for i . 2010 1:16 pm Attention: You do NOT need to create an input parameter for &inDate in the Selection criteria tab. 'D'. this define field will create the prompt for an input parameter named &daysRange (when the report is run). Again. The format is YYMD and the expression is DATEADD( inDate2. 4. The format is YYMD and the expression is DATEADD( inDate2. Create a DEFINE field named endRange.

Appendix B. 2010 1:16 pm 7214ax02. 5. Select WHERE for both conditions. ate and time functionality 559 . This is because the second and third DEFINE fields contain expressions that reference the first DEFINE field.fm Figure B-34 DEFINE field endRange This DEFINE field will return a date that is the specified number of days greater than the specified input date. If you define them out of order. Next go to the Selection Criteria tab and create two screending conditions for the ORDERDATE column.Draft Document for Review January 3. the expression will fail because it will be unable to find and resolve DEFINE field inDate2. Important: The order that you create these DEFINE fields is very important. An example is shown in Figure B-35 on page 560. – The first condition is GREATER THAN OR EQUAL TO the beginRange DEFINE field – The second condition is LESS THAN OR EQUAL TO the endRange DEFNE field.

560 Getting Started with DB2 Web Query for i .7214ax02. PRODUCTTYPE – Sum: COSTOFGOODSSOLD. 2010 1:16 pm Figure B-35 Dynamic Date Range Report selection criteria 6. Finally. LINETOTAL An example is provided in Figure B-36.fm Draft Document for Review January 3. return to the Field Selection tab and complete the report by selecting the following Sort by and Sum report columns: – Sort by: ORDERDATE.

fm Figure B-36 Sort by and Sum columns 7. 9. Run the new Dynamic Date Range report 10. The report returns rows for orders between 11/06/2007 and 11/16/2007 as shown in Figure B-37. Save your report as Dynamic Date Range 8.Draft Document for Review January 3. 2010 1:16 pm 7214ax02. Appendix B. Click Quit to return to the DB2 Web Query launch page.Specify 20071111 for the inDate parm and 5 for daysRange 11.Click Run. ate and time functionality 561 .

fm Draft Document for Review January 3. 2010 1:16 pm Figure B-37 Dynamic Date Range report results 562 Getting Started with DB2 Web Query for i .7214ax02.

2010 1:16 pm 7214ax02b.fm C Appendix C.Draft Document for Review January 3. 2009. we describe how DB2 Web Query processes a define or compute field at different points in the reporting sequence. All rights reserved. 563 . Processing differences between the define and compute fields In this appendix. Web Query Processing Sequence Locate the file description(s) and data files Select records based on database values Determine values of DEFINEdfields Select records based on DEFINEdfields Sort the Data COMPUTE works with aggregated values DEFINE works with individual database values Prepare individual and/ or aggregated values Resolve COMPUTEdfields Select records based on TOTAL tests Format the report Figure C-1 DB2 Web Query processing sequence © Copyright IBM Corp. Figure C-1 shows the reporting sequence to illustrate the differences between the define and compute.

After determining the values of the define fields. SUM. DB2 Web Query then processes the WHERE test on a database value to select a valid record for the report. DB2 Web Query determines the value of each define field. DB2 Web Query performs the final selection test. it locates the Master File Description (MFD) and the database. 2. After evaluating the compute fields.7214ax02b. DB2 Web Query then takes the processed data and determines the values of any compute fields. 3. in the sequence in which they appear in the request. it performs any WHERE TOTAL tests against any aggregated results and the values of the compute fields. it aggregates the values in memory. it executes any selection tests that use the value of a define field and potentially further limits the number of records per report. 4.fm Draft Document for Review January 3. or COUNT). 564 Getting Started with DB2 Web Query for i . 5. 2010 1:16 pm We explain the sequence in greater detail as follows while noting the differences between the two fields: 1. Finally DB2 Web Query formats the report and routes it to your Web browser. and thereby further limits the records for the report. If the report uses SUM or COUNT. After selecting a record. DB2 Web Query then sorts the data (according to the BY and ACROSS phrases) and performs the action indicated in the verb phrase (PRINT. 6. When DB2 Web Query begins to process a report request. in sequence.

fm D Appendix D. The parts we need to consider are the metadata. © Copyright IBM Corp. 565 . Change Management considerations Using DB2 Web Query. We could need to move these between a development and production system or just between multiple systems. 2010 1:16 pm 7214ax02c. such as images.Draft Document for Review January 3. there are several items we need to consider for moving reports between systems. There are two major ways to do change management in Web Query that will be discussed in this apprendix. All rights reserved. 2009. the reports. and any supporting elements.

However. 2010 1:16 pm Developer Workbench The simplest way to move items between multiple systems is using Developer Workbench. the process is almost the same. there is still hope.htm You must log in as QWEBQRYADM at the console home screen. and supporting files such as images. We need to think in two parts: metadata and everything else. On the left are all the objects you are authorized to. click Create Change Package and download the zip file. click on Utilities. From here. You can access the Web Query console by going to: http://systemname:11331/webquery_html/wfconsole. This works for all types of items: metadata. you are now prompted to login with a profile that has authority to the domain containing the objects you wish to move. reports. and images. Keep in mind that most metadata entries have libraries hard coded in them. Place the zip in the /qibm/userdata/webquery/ibi/webfocus76/utilities/cm/load/ directory. As a reminder. Since all the metadata is stored in these folders under /qibm/userdata/webquery/ibi/apps. Now we need to move the reports over.fm Draft Document for Review January 3. the process becomes a little more complex. and extract. moving metadata is not going to be useful. or individual items. Login with your normal Web Query profile. for example). If you are an ISV or are developing a "portable" application. Since the QWEBQRYADM profile is usually not authorized to any domains. This requires a connection to both systems at the same time to make this work. HTML pages. domains. You can select either an entire domain to move. you will need to have MRADMIN 566 Getting Started with DB2 Web Query for i . So if the data is in MYTESTDATA on the dev system and MYPRODDATA on the prod system. Instead.7214ax02c. Those individual items can be reports. The metadata exists in application folders off of the /qibm/userdata/webquery/ibi/apps directory. MR Change Management. Once all the items are selected and appear on the right hand side. HTML pages. MR Change Management. whenever we are FTP'ing a save file. the metadata should be recreated on the production system to embed the proper schema names. See section 3B. and empty panel that will fill to show which items you have selected. Select Utilities. we can simply use a save file to save that folder and restore it on another system. Log into the Web Query console as QWEBQRYADM. Move this zip file on to the system you want to load the reports on to. We are half way there. From there. Once both systems are added and expanded in Developer Workbench.x (new section from Gene) for details on metadata segregation. folders. Once the folder is restored on the other system. graphs. we need to do so in binary (bin) mode. you will be presented with a two panel screen. you can simply drag and drop between systems. On the right. If you are importing an entire domain. but now select Load instead of Extract. applications. you should consider creating your metadata in an application folder. Here. Without Developer Workbench If you do not have Developer Workbench or cannot get a connection to both systems at the same time (ISV selling an application built with the SDK to a customer. We can do this using the Change Management facility built into the Web Query console. it is set to go.

Select the one you just created to move to the right side and click Load Change Package. I confirmation message will appear when the load is complete. we have the two panel screen. which is essentially what you are doing during the load.fm authority since that is the only level that can create a new domain.Draft Document for Review January 3. For more details on this process. Appendix D. 2010 1:16 pm 7214ax02c. showing the available packages on the left. Again. Change Management considerations 567 . please see IBM i Knowledge Base Document 517159487.

7214ax02c. 2010 1:16 pm 568 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3.

you can go to the IBM Redbooks Web site at: ibm.redbooks.Draft Document for Review January 3.DB2 Web Query for System i © Copyright IBM Corp. 2010 1:16 pm 7214addm. Point your Web browser at: ftp://www.com/redbooks/SG247214 Alternatively.com/redbooks Select the Additional materials and open the directory that corresponds with the IBM Redbook form number.ibm.fm E Appendix E. 2009. SG247214. All rights reserved. Using the Web material The additional Web material that accompanies this book includes the following files: File name QWQCENT. 569 . Additional material This book refers to additional material that can be downloaded from the Internet as described below.savf Description iSeries Library System requirements for downloading the Web material The following list contains the most important requirements: i5/OS V5R4 5733-QU2 . Locating the Web material The Web material associated with this book is available in softcopy on the Internet from the IBM Redbooks Web server.

2010 1:16 pm How to use the Web material Create a subdirectory (folder) on your workstation. and unzip the contents of the Web material zip file into this folder and upload the i5/OS save file to your System i environment.7214addm. 570 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3.

com/infocenter/iseries/v5r4/topic/cli/rzadp.fm Related publications The publications listed in this section are considered particularly suitable for a more detailed discussion of the topics covered in this book.com/ DB2 for i5/OS Portal http://www.pdf Indexing and Statistics Strategies for DB2 for i5/OS http://www.com/developerworks/spaces/DB2WebQuery System i Database DB2 UDB SQL call level interface (ODBC) http://publib. see “How to get IBM Redbooks” on page 571.com/servers/enable/site/education/ibo/record.informationbuilders. IBM Redpapers™. Technotes. as well as order hardcopy Redbooks. 2009. SG24-7326 Preparing for and Tuning the SQL Query Engine on DB2 for i5/OS. OnDemand SQL Performance Analysis Simplified on DB2 for i5/OS in V5R4. SG24-6598 SQL Performance Diagnosis on IBM DB2 Universal Database for iSeries. 571 . draft publications and Additional materials.ibm. at this Web site: ibm.com/systems/i/software/db2 DB2 Web Query http://www-03.boulder. 2010 1:16 pm 7214bibl. view.com/redbooks © Copyright IBM Corp. All rights reserved.ibm.ibm.ibm. SG24-6654 Online resources These Web sites are also relevant as further information sources: Information Builders Corporate http://www. or download Redbooks. IBM Redbooks For information about ordering these publications.Draft Document for Review January 3.com/systems/i/software/db2/webquery/ DB2 Web Query for i developerWorks Community http://www.html?indxng How to get IBM Redbooks You can search for.ibm. Note that some of the documents referenced here might be available in softcopy only.

com/support IBM Global Services ibm.com/services 572 Getting Started with DB2 Web Query for i .fm Draft Document for Review January 3.7214bibl. 2010 1:16 pm Help from IBM IBM Support and downloads ibm.

302 dual axis 160 multiple bars to one chart 156 with drill-down capabilities 154 basic synonyms 344 basic user 85 Basic user tasks 25 benchmark. 450 B bar chart 152. assignment to users 35 authorization of users 19 C calendar controls 316 call-level interface (CLI) 22 capabilities of DB2 Web Query 480 cell formatting 382 CENTURY 43 Change report 35 chart. 18 5733-QU2 (DB2 Web Query) 5–7. 17–18. 229. 229. 2010 1:16 pm 7214IX. 91 Common Domain folder 32 compound parameterized report 290 bar chart 302 gross profit report 303 HTML page options 303 HTML report 296 line chart 298 New form element 300 compute field 190. 13. 573 . 254. All rights reserved. 451. 490 CLI (call-level interface) 22 cluster 99 cluster join 354 Common Domain 32. revenue trend over time 167 CHGUSRPRF 31 child table 57 Classic Query Engine (CQE) 5.fm Index Symbols *QRYDFN 4 automatic generation or refresh of metadata 486 autostart after IPL 484 Available fields icons 100 Numerics 3020 record 462 5722-QU1 (Query/400) 4–5. 13. DB2 Web Query 474 Burst this Report 400 Burst Value 406 Business View 361 Business Views 46 A access file 45. 451. 481 active visualizations 502 ActiveX controls 235 cross-tab or pivot functionality 243 e-mail user requirements 502 file size 502 filtered chart 240 general use of 235 highlights 230 license key 231 overview 230 problems saving 502 report creation 231 tutorial 229 Active Reports Styling 232 ActiveX controls 235 adapter 13 optimization 438 processing 438 Add Adapter Configuration 385 ADDLICKEY command 384 add-on products 501 ADDRDBDIRE command 73 ADDWQLUSR 29 ADMIN 39 Administration Console 13 Administration console 394 Administrator tasks 25 administrator tasks 31 assignment of authority to users 35 domains 31 subfolder creation 34 Advanced 399 aggregate field 125 aggregation optimization 445 AJAX 7. 377 configuration of Developer Workbench 250 Configuring Report Broker 394 Connection Name 74 Contains operand 239 CPU resource usage 476 CQE (Classic Query Engine) 5. 227. 563 computing fields 115 conditional styling 118. 2009. 512 Active Reports 8.Draft Document for Review January 3. 190. 93. 93. 490 CREATE ALIAS 55 Create domain 35 Create report 35 Create subfolder 35 © Copyright IBM Corp. 481 analysis 466 application server 11–12 architecture 11 auditing 485 authority. 43.

fm Draft Document for Review January 3. 13 DB2 Heritage File adapter 13 Query/400 7 data download to PC server or Windows server 483 data field. 387 Creating Metadata 387 cross-system join 72. 480 Graph Assistant 6 imported Query/400 object 490 imported Query/400 query 490 installation 18 installation and server operations 17 integration with Excel 2007 501 integration with Rational tools 483 introduction 5 license keys 19 login 29 multiple licenses 489 named user 486 object import from Query/400 489 OLAP feature dimensions 501 optional features from IBM 7 optional features from Information Builders 9 PC and System i requirements 20 performance benchmark 474 performance considerations 435 port 11331 for HTTP requests 484 Power Painter 7 product information 378. 13 performance 436 DB2 file output 132 DB2 for i5/OS database.7214IX. 418. 480 product positioning 15 QRYDFN edit 433 Query/400 definitions 490 reasons to move from Query/400 480 referential integrity 57 Report Assistant 6 report auditing 485 report development 490 report run from CL program 496 Reporting Server 13 commands 22 reports from Query/400 489 running existing Query/400 reports 427 running in an IASP environment 565 RUNWEBQRY command 496 save and restore 504 server jobs 22 server-based processing 484 servlet 12 sign-on via LDAP or Kerberos 485 sorting optimization 445 stored procedures with input parameters 492 574 Getting Started with DB2 Web Query for i . 384. 484 exception join 489 features 6 functional differences with Query/400 429 functional similarities with Query/400 428 general announcement 378. 2010 1:16 pm Create Synonym 49. format conversion 517 data profiling 8. 348 date field 516 conversion 517 date component conversion 517 in arithmetic expressions 516 date format 514 display options 514 date formatting 109 date range filter 176 date range parameter 181 DATEADD function 555 DATEDIFF function 556 DATEMOV function 556 DB2 11 DB2 CLI adapter 7. 384. 55 DB2 Web Query 5 additional features 481 administrator tasks 31 adopted authority for reports 485 aggregation optimization 445 architecture 11 attributes 12 autostart after IPL 484 base features 6 capabilities 480 conditions that prevent optimization 443 data adapters 13 Developer Workbench 15 domain authority 485 domains 31. 418. 13. 13 DB2 CLI 7. query without multiple licenses 489 optimization 451 referential integrity features 486 DB2 Heritage File adapter 7. 495 graphics 496 periodic report 496 Dashboards in Excel 381 data adapters 7. 448 cross-tab functionality 243 cross-tab report 113 D dashboard 15. 366 Data Range Properties 382 database analysis and tuning 472 design 451 monitor 473 database joins 46 Datasource 74 date component conversion 517 functions 555 manipulation 350 separator 516 date and time functionality 513 system variables 514 Date Decomposition 8. 13 DB2 Heritage File 7.

15. 418. 2010 1:16 pm 7214IX. Graph Assistant 166 Graph Assistant 6 bar chart 152 conditional styling 190 date range parameter 181 drill down 158 dual axis bar and line chart 160 graph properties 166 line graph 169 pie charts 184 traffic lighting a graph 190 gross profit report 303 group profile MDUNTITLED 90 Group profiles 26 GRPPRG user profile. 393. 484 authority 485 create 33 creation 33 eight-character rule 32 rename 34 renaming 34 domain-level report movement 487 double-spaced printing 494 drill down 15. 393. 159 adding to chart 158 bar chart 154 drill downs 377 drill-down report 138 further drill downs 494 Email option 400 ENDWEBQRY 393 ENDWEBQRY command 22 Establishing a connection 384 Event driven distribution 416 Excel 6 output 130 with formulas option 501 Excel 2000 130 Excel 2007 integration with DB2 Web Query 501 Excel 97 130 Excel spreadsheet access to another spreadsheet 501 integration 499 report 499 exception joins 489 Extensible Markup Language (XML) 6 F FAQs (Frequently Asked Questions) 383. 344 synonym management 487 dicing 7 dimensions 259 Distribute report by 400 Distribution 399 domain 30–31. 249. 563 defining fields 115 detail reports 102 Developer tasks 25 developer tasks 43 creation of metadata 47 cross-system join 72 Developer Workbench 7.fm training and education 506 upgrade to 489 user security 485 web console 484 DB2 Web Query domain 26 DB2 Web Query users 25 DB2 Web Query V1R1M1 394 DDS Logical files 45 define field 190. 479 federated DB2 7 filter creation 352 Foreign key option 100 foreign key relationships 446 foreign keys 388 format conversion 517 formatting 377 formula support 377 Frequency 399 Frequently Asked Questions (FAQs) 383. 384.Draft Document for Review January 3. 480 generic term report 290 graph building with Power Painter 201 properties and settings. 97. 479 fullselect 446 G general announcement 378. domain authority 485 H hierarchy 259 Highlight button 239 highly parameterized report 305 calendar controls 316 E EDAPGWY 22 EDAPLOG 22 EDAPTH 22 Index 575 . 482 additional features 343 Business View 361 configuration 250 data profiling 366 Date Decomposition 348 date manipulation 350 default options 254 filter creation 352 HTML Layout Painter 289 Impact Analysis 363 Java 2 SDK 21 not part of base DB2 Web Query product 502 OLAP 257 profiling 249 requirements 21 hardware 21 software 21 SQL Wizard 369 Synonym Editor 249.

231 line chart 160. 2010 1:16 pm Highly Parametrized reports 411 HLISNK 23 host table 443 Href 32 HTML launch page 380 HTML Layout Painter 249. 447. 298 line graph 169 date range filter 176 Log Purge Period 396 Log Purge Time 396 long-running report 466 M Managed Reporting drivers 13 Master file 46 master file 254. 473 Index Only Access 461.fm Draft Document for Review January 3. 289 compound parameterized report 290 highly parameterized report creation 308 parameter controls 313 Run button 304 tool 8 HTML page options 303 HTML report 296 HTTP clients 11 L LDAP sign-on 485 Left Outer Join 143 library list-like behavior 487 license key 19. 511 materialized query table (MQT) 50. 473 Materialized Query tables 45 MDUNTITLED group profile 19. 473 MRADMIN 393 MRADMIN group 90 MRADMIN group profile 19 MRSCHEDULE 393 multi-dimensional 7 multimember files 54 multiple bars on one chart 156 multiple instance 143 multiple members 13 multiple result sets 54 multiplicative effect 443 I i5/OS system objects 18 IBM DB2 Web Query for System i 5 IBM Query for System i 4 icons for Available fields 100 IDE (Integrated Development Environment) 15 Impact Analysis 8.7214IX. 90 memory usage 477 Metadata 45 metadata 6. 461 Index Advisor 462. synonym management 486 J Java 2 SDK 1. 473 Information Builders optional features 9 Inner Join 143 input parameters 492 Installation 378 installation 17–18 Installing Report Broker 394 Integrated Development Environment (IDE) 15 integrated file system 12 directories 18 metadata 511 integration with Rational tools 483 iSeries Navigator.0_09 21 JDBC driver 384 join disablers 443 join optimization 442 join relationship 486 join segments 65 join types 143 join.5. table 354 joining tables 142 joins in DB2 Web Query synonyms 65 JSCOM3 22 N named user 486 licenses 8 New form element 300 Notification 399 number of rows 491 K Kerberos sign-on 485 key constraints 59 key performance indicators (KPI) 15 576 Getting Started with DB2 Web Query for i . 363 imported report 490 index 446. 47 aliases 50 automatic generation or refresh 486 considerations for creation 50 deletion of 512 from Query/400 objects 430 MQT 50 prefix and suffix 433 stored procedures 50 tables 50 views 50 metadata creation i5/OS object deleted 56 miscellaneous considerations 50 multimember files 54 model 8nn system 483 MQT (materialized query table) 447.

480 projection 441 Q QRYDFN edit by DB2 Web Query 433 objects 427 QSQSRVR 23 Query/400 4.Draft Document for Review January 3. 450 adapter performance 450 definitions 490 functional differences with DB2 Web Query 429 functional similarities with DB2 Web Query 428 imported query 490 metadata from Query/400 objects 430 migration of reports to DB2 Web Query 489 object 490 object import 489 product history 4 reasons to move to DB2 Web Query 480 report development 490 running existing reports in DB2 Web Query 427 QWEBQRYADM 19 QWQCENT 43 P palettes 198 parameter controls 313 parameter passing 429 parameterized report 133 design 498 multiple item selection 493 parameters. 2010 1:16 pm 7214IX. 427–428 5722-QU1 5 adapter 7. 418. 384. adding 290 parent report 138 parent tables 57 PC requirements 20 PC server 483 PDF (Portable Document Format) 6 distributing batch reports via e-mail 502 output 129 performance R ranking columns 126 Index 577 . 257 operational reports 15 OPNQRYF command 13 optimization 443 DB2 for i5/OS 451 disablers 466 hierarchy 441 other influencers 445 Other Files folder 32 output files for next query 429 output options 127 adapter processing and optimization 438 basics 436 benchmark for DB2 Web Query 474 case study 466 DB2 CLI adapter 436 DB2 Web Query 435 Query/400 adapter 450 remote database access 448 pie chart 184 product type for each year 184 pivot functionality 243 port 11331 for HTTP requests 484 Portable Document Format (PDF) 6 PostScript 6 Power Painter 7 building a graph 201 building a report 209 Clustered Bar chart 202 dashboard 495 Data Sources palette 200 launching 198 PDF report 217 Properties palette 200 tailoring the main window 198 Predefined Server configurations 378 prefix 49 and suffix 49 metadata 433 primary key 57 printing.fm O offline reporting 8 OLAP dicing 268 dimension 258 Dimension Builder 261 dimensions for database 501 drill down 258 drill-down options 267 enabled report 268 enablement 266 getting started 258 grouping data 286 hierarchy 258–259 hyperlinks 258 measure 258 metadata 259 modeling view 260 pivot 258 slicing 268 Synonym menu 261 terminology 258 tutorial 257 OLAP (online analytical processing) 7. 257 OLAP Control Panel 279 OLAP dimensions 46 OLAP module 481 OLAP report on demand column sort 501 prior selections 501 on-demand paging 128 online analytical processing (OLAP) 7. double-spaced 494 product information 378.

fm Draft Document for Review January 3. 133 Report Assistant 6 date formatting 109 DB2 file output 132 drill-down reports 138 Excel output 130 footings 120 generating subtotals 123 headings 120 on-demand paging 128 output options 127 parameterized reports 133 PDF output 129 ranking columns 126 report properties 141 selection criteria 110 sort by aggregate field 125 sorting 125 style sheet 491 subtotal generation 123 Report Assistant mode 379 Report Assistant route 379 Report Broker Administrator 412 Report Broker and Active Reports 415 Report Broker distribution list 405 Report Broker Schedule panel 398 report developer. 490 SQE Plan Cache 462. SQL statements 502 Report Library 15 Report Options 399 Reporting Server 11. 2010 1:16 pm Rational tools 483 RDBMS (relational database management system) 11 Redbooks Web site 571 Contact us xvi referential constraint 57 referential integrity 442 benefits in DB2 Web Query 57 DB2 for i5/OS 486 Refresh Synonyms 487 Registered/named users 26 relational database management system (RDBMS) 11 remote database access 448 report adopted authority 485 building with Power Painter 209 creating with Active Reports 231 creation 98 development 490 development phase 491 distributing batch reports in PDF via e-mail 502 execution phase 437 layout 99 long-running 466 production phase 438 Query/400 reports in DB2 Web Query 427 request process flow 436 sample detail 114 security for specific user 485 selection defined on expression 497 tuning options 468 types 15.7214IX. 472 578 Getting Started with DB2 Web Query for i . 13 commands 22 Reports folder 32 requirements 20 restore 504 revenue trend over time chart 167 Right Join 428 RMVWQLUSR 29 row quantity 491 RSTLICPGM command 17 Run button execution 304 Run Interval 400 Run report 35 Run Time User Enablement option 28 Run time users 26 RUNBRSCHED 416 RUNWEBQRY command 496 database file option 497 registered named user 497 S sample detail report 114 save 504 SCHED 39 Scheduling Frequency 402 scorecards 15 second Y axis 163 securing Metadata 79 Security 74 security specific user 485 user 485 segmented metadata 80 Segmenting Metadata 79 selection 440 selection criteria 110 Sent as an attachment 400 server jobs 22 EDAPGWY 22 EDAPLOG 22 EDAPTH 22 HLISNK 23 JSCOM3 22 QSQSRVR 23 TSCOM3 22 WQLWI7 23 server operations 17 server-based processing 484 servlet container 12 servlet engines 12 SET CURRENT DEGREE 51 SET OPTION SRTSEQ 51 single instance 143 slicing 7 sort by aggregate field 125 sorting optimization 445 Spreadsheet Client 377 Spreadsheet Client Manual 382 spreadsheet reports in Excel 499 SQE (SQL Query Engine) 5.

synonym management 486 Windows server 483 Work with Web Query 28 WQLWI7 23 WRKLICINF 29 WRKLNK command. 249. 2010 1:16 pm 7214IX.0 481 Web Application Bundle (WAB) file 13 Web browser clients 12 web console 484 Web server 11–12 Web-based query and report writing function 481 WebFOCUS 291 WebSphere Application Server 484 WHERE 111 WHERETOTAL 111 Windows Explorer. 490 SQL statements. 473 W WAB (Web Application Bundle) file 13 Web 2. 468 individual movement 505 management 486 Synonym Candidates 48 Synonym Editor 249. 369 statistics 461 stored procedure input parameters 492 Stored procedures 45 Structured Ad-Hoc Form mode 380 STRWEBQRY 393 STRWEBQRY command 22 style sheet 491 subfolders creation 34 suffix 49 and prefix 49 metadata 433 sum reports 102 summary report 99 SUPGRPPRF parameter 485 Supplemental Group (SUPGRPPRF) parameter 485 Symmetric Multi Processing 51 synonym 5–6. 343–344. Refresh option 487 System i objects 93 requirements 21 system objects 18 U unique join 443 upgrade to DB2 Web Query 489 Usage 379 USER 39 user authorization and verification 19 user security 485 user-specified date range parameter 181 V variables in report headings and footings 120 verification of users 19 view 446 Viewing the Distribution log 410 virtual columns 46 Visual Explain 462. 487 Synonyms.Draft Document for Review January 3. report developer 502 SQL trace 466 SQL translation 441 SQL view 468. synonym management 487 WRKRDBDIRE command 72 WRKWEBQRY 393 WSff0ad76f515651cb176dad510f7220ddaa-68e6 279 X T table join 354 Tables/physical files 45 target table 443 time and date functionality 513 trace statements 466 traffic lighting a graph 190 conditional styling 118 TRCWEBQRY command 22 TSCOM3 22 tutorial Active Reports 229 getting started 89 OLAP 257 XML (Extensible Markup Language) 6 Y Y axis 163 Index 579 .fm SQL catalog views 93 SQL CREATE TABLE 93 SQL fullselect 446 SQL Performance Monitor 462 SQL Plan Cache snapshot 462 SQL Query Engine (SQE) 5. 493 creation 445 new report 470 SQL views 45 SQL Wizard 8.

fm Draft Document for Review January 3. 2010 1:16 pm 580 Getting Started with DB2 Web Query for i .7214IX.

Move the changed Conditional text settings to all files in your book by opening the book file with the spine. you would use the .0” spine) 0.873” 250 <-> 459 pages Getting Started with DB2 Web Query for i (0. you divide the paper PPI into the number of pages in the book.17”<->0.fm still open and File>Import>Formats the Conditional Text Settings (ONLY!) to the book files.5” spine) 1.5” spine) 0.1”<->0.To determine the spine width of a book.5” spine. An example is a 250 page book using Plainfield opaque 50# smooth which has a PPI of 526.5”<-> 1. In this case.475”<->0.998” 789 <->1051 pages Getting Started with DB2 Web Query for i Getting Started with DB2 Web Query for i (1.1”spine) 0.169” 53<->89 pages . Divided 250 by 526 which equals a spine width of .4752".875”<->1. 2010 1:16 pm 7214spine. Draft Document for Review January 3. Now select the Spine width for the book and hide the others: Special>Conditional Text>Show/Hide>SpineSize(-->Hide:)>Set .473” 90<->249 pages (0.fm 581 Getting Started with DB2 Web Query for i (1.2”spine) 0.498” 460 <-> 788 pages (0.

5” spine) 2.To determine the spine width of a book.4752".0” <-> 2. 2010 1:16 pm 7214spine.0” spine) 2. Divided 250 by 526 which equals a spine width of . you divide the paper PPI into the number of pages in the book. In this case. Draft Document for Review January 3.fm still open and File>Import>Formats the Conditional Text Settings (ONLY!) to the book files. An example is a 250 page book using Plainfield opaque 50# smooth which has a PPI of 526.5”<->nnn.n” 1315<-> nnnn pages Getting Started with DB2 Web Query for i (2.fm 582 Getting Started with DB2 Web Query for i (2. you would use the . Move the changed Conditional text settings to all files in your book by opening the book file with the spine. Now select the Spine width for the book and hide the others: Special>Conditional Text>Show/Hide>SpineSize(-->Hide:)>Set .498” 1052 <-> 1314 pages .5” spine.

.

and Power Painter.î if you will simply be running OLAP-enabled reports. extensible. IBM DB2 Web Query for System i includes Query for iSeries technology to assist customers in their transition to DB2 Web Query. Much of Chapter 8.î is appropriate for those who work disconnected from the System i environment. dash boarding. you can use much of Chapter 10. It entails a group of self-explanatory tutorials to help you get up to speed quickly. Ö. Using these tools. WAS Java.Draft Document for Review January 3. It offers a more modernized. traditional batch. DB2 Web Query provides Report Assistant. ìTutorials for DB2 Web Query optional features.com/redbooks SG24-7214-01 ISBN .î and Part 3. This IBM Redbook publication gives a broad understanding of the new DB2 Web Query product. For more information: ibm. Customers and Partners from around the world create timely technical information based on realistic scenarios. Experts from IBM. ìOLAP (Online Analytical Processing). such as online analytical processing (OLAP). data mining. Graph Assistant.î as stand-alone tutorials for anyone who is developing their own queries. or data warehouse implementations. Include 5250. customers can modernize existing Query for iSeries reports while providing a foundation for building more complex business intelligence applications. You can extract and use Part 2. Specific recommendations are provided to help you implement IT solutions more effectively in your environment. Java-based solution for a more robust.? (Subset of Workload Estimator (WLE) workloads INTERNATIONAL TECHNICAL SUPPORT ORGANIZATION BUILDING TECHNICAL INFORMATION BASED ON PRACTICAL EXPERIENCE IBM Redbooks are developed by the IBM International Technical Support Organization. and productive reporting solution. ìActive Reports. Overall this book is designed for IT users. ìTutorials for DB2 Web Query. In addition. 2010 2:34 pm Back cover ® Getting Started with DB2 Web Query for i ® Follow the best practice guides to simplify report development Take your reporting to the next level of Business Intelligence Learn DB2 Web Query by using the easy to follow tutorials The DB2 Web Query for System i product is a Web-based query and report writing product that offers enhanced capabilities over the IBM Query for iSeries (also commonly known as Query/400) product.

Sign up to vote on this title
UsefulNot useful