Вы находитесь на странице: 1из 22

The Evolution of DB2 Application Development

Written by,
Jim Wankowski
Quest Software, Inc.

White Paper
© Copyright Quest® Software, Inc. 2007. All rights reserved.
This guide contains proprietary information, which is protected by copyright. The
software described in this guide is furnished under a software license or
nondisclosure agreement. This software may be used or copied only in accordance
with the terms of the applicable agreement. No part of this guide may be reproduced
or transmitted in any form or by any means, electronic or mechanical, including
photocopying and recording for any purpose other than the purchaser's personal use
without the written permission of Quest Software, Inc.

WARRANTY

The information contained in this document is subject to change without notice.


Quest Software makes no warranty of any kind with respect to this information.
QUEST SOFTWARE SPECIFICALLY DISCLAIMS THE IMPLIED WARRANTY OF THE
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Quest Software
shall not be liable for any direct, indirect, incidental, consequential, or other damage
alleged in connection with the furnishing or use of this information.

TRADEMARKS

All trademarks and registered trademarks used in this guide are property of their
respective owners.

World Headquarters
5 Polaris Way
Aliso Viejo, CA 92656
www.quest.com
e-mail: info@quest.com
U.S. and Canada: 949.754.8000

Please refer to our Web site for regional and international office information.

Updated—April, 2007
CONTENTS
INTRODUCTION ................................................................................. 2
DB2 ................................................................................................... 3
A NEW LANGUAGE IS BORN ............................................................... 4
UNIVERSAL DATABASE ............................................................................4
CLIENT/SERVER ................................................................................ 5
THE CHANGING IT ENTERPRISE ........................................................ 6
THE MODERN DAY DEVELOPER .......................................................... 7
TOAD® FOR DB2................................................................................ 8
REFERENCING OBJECTS: THE DEVELOPER’S PERSPECTIVE ................ 9
DATABASE BROWSER .............................................................................9
ACCESSING DATA: IT’S MORE THAN JUST WRITING A SELECT STATEMENT ........... 10
DATA EDITOR .................................................................................... 11
EXPORT WIZARD ................................................................................ 12
MASTER DETAIL BROWSER..................................................................... 12
BUILDING AND TESTING SQL CALLS FOR THE MAINFRAME ............. 13
SQL MODELER ................................................................................... 14
QUERY EDITOR .................................................................................. 14
BUILDING SQL .................................................................................. 15
OPTIMIZING SQL................................................................................ 16
CONCLUSION ................................................................................... 18
ABOUT THE AUTHOR ........................................................................ 19
ABOUT QUEST SOFTWARE, INC. ...................................................... 20
CONTACTING QUEST SOFTWARE .............................................................. 20
CONTACTING QUEST SUPPORT ................................................................ 20

1
INTRODUCTION
In the 1970s, the majority of data was stored in flat file formats such as
VSAM or in a hierarchical database management system (DBMS) called
information management system (IMS). These applications were running
exclusively on large mainframes. Another format for databases, the
Network model, was similar in concept to the relational model, but never
gained much acceptance. IMS was known for its fast transaction speeds but
was very tedious to program and to administer; its limited hierarchical model
could not handle more than one relationship. During this time, IBM was also
developing a new type of database based on Edgar Codd’s relational model
developed in the late 60s. This database used a flexible programming
language called Structured Query Language (SQL). This whitepaper will
discuss how DB2 application development has evolved over the last three
decades and the lessons developers can learn from technology innovations.

2
DB2
In 1983, IBM introduced its next generation relational database --Database
2, or better known as DB2. Although DB2 was available in the fall of 1984,
IT organizations were slow to adopt this innovative technology due to its
relatively high overhead, and its slow transaction speed compared to IMS.
The MVS (multiple virtual storage) boxes of the day just didn’t have the
horsepower to run large volumes of data through DB2. As mainframe
hardware matured through the 1980s, DB2 grew to be the database of choice
for many companies.
The 1990s saw an explosion of growth for DB2 as the databases’ speed,
reliability, and functionality was vastly improved. This coincided with a
dramatic increase in mainframe horsepower. Currently, IT organizations are
moving to the existing IBM flagship database and the standard RDMS for
mainframe applications.

Figure 1: Mainframe DB2 Timeline

3
A NEW LANGUAGE IS BORN
The majority of programming in the 1970s and 1980s was done in COBOL,
PL/I, Assembler, or FORTRAN. Developers and end users used 3270 “green
screen” dumb terminals. Program calls accessing data either in flat files,
VSAM, or in IMS were limited in scope. Applications of the day were not very
flexible and ad-hoc queries were inconceivable. Predicate logic or the ability
to handle multiple relationships did not exist. Data had to be retrieved and
then collated into the appropriate result set programmatically. With the
release of DB2 and SQL, application developers acquired new programming
concepts. A program call with multiple pages of code was condensed to a
single SQL call. The flexibility of the new programming language simplified
programming, but it also created new performance issues. The language
could generate a complex query/result set all from a single call, but if the
SQL statements were not coded efficiently, horrendous performance would
result. The other advantage to the SQL language is that the database calls
could be created and tested independently from the applications. The SQL
statement could be written, executed, and analyzed without someone having
to compile and execute an application program.

Universal Database
In 1989, IBM released a version of DB2 designed to initially run on its OS/2
operating system. The new version experienced name changes such as
DB2/2 and DB2 Common Server (DB2/CS), but in an effort to capitalize on
the momentum of DB2 running on the mainframe, a new name arose; the
universal database (UDB) to refer to DB2 across all platforms. IBM also
began synchronizing the release numbers starting with V6. DB2 never
gained much market share in the ‘90s when it ran on distributed platforms.
This changed around V7.0 when IBM began to heavily market DB2 to
compete with Oracle. Success and growth occurred with the adoption of DB2
on Linux, Unix and Windows.

Figure 2: DB2 for Linux, Unix, and Windows

4
CLIENT/SERVER
A completely new concept emerged in the early ‘90s when DB2 faced
explosive growth. Windows-based workstations communicating with UNIX
servers via networks were believed to be the new generation of data
processing that would effectively eliminate the need for mainframes in three
to five years! This new technology would promise the same results as the
big clumsy, expensive mainframes for a fraction of the cost. The novel
concept gave birth to other relational databases designed specifically for
these types of platforms. Oracle, teetering on the verge of bankruptcy in the
late ‘80s, saw a huge boost in sales, along with Sybase and SQL Server.
Huge learning curves arose for these new environments, considering the
lion’s share of IT professionals were primarily mainframe-oriented. A mass
exodus of mainframe expertise occurred as technologists hoped to move over
to this new technology. The advanced concept drove companies to spend
exorbitant amounts of money on client server systems only to have them fail
due to limitations of the workstations, networks and servers.

5
THE CHANGING IT ENTERPRISE
Toward the end of the ‘90s and into the present, the typical corporate
enterprise network began to diversify into a much more distributed
environment. As Unix and Windows servers grew more powerful and
reliable, mission-critical data started to get pushed to multiple DBMSs
running on various platforms. This, along with the Internet, required newly
written applications since they completely changed the way companies did
business. Web-based or other distributed types of applications such as
Websphere are now the order of the day. The prediction of an obsolete
mainframe proved false in the current IT world, and instead the mainframe
has become an integral data server for very large, complex enterprises. It is
estimated that over 75 percent of the world’s business data resides on
mainframes. The end-user e-business applications tend to be Unix-based, but
the mainframe remains the core data repository. The Unix server still cannot
match the mainframe’s capacity, reliability, security, and processing power.

6
THE MODERN DAY DEVELOPER
Developers today typically code in object-oriented languages such as C,
C++, JAVA, or .NET with graphical user interface (GUI) front ends. These
new applications may extract data from multiple sources including the
mainframe via dynamic SQL calls. The current generation of developers has
little or no concept of mainframes or 3270 interfaces -- instead, they are
coding Windows, or internet-based applications accessing mainframe data.
These developers need GUI-based tools that provide them with the ability to
reference objects, access data, and build or test SQL calls off the mainframe.

7
TOAD® FOR DB2
Toad® for DB2 provides a proven, intuitive tool that improves user
productivity and code quality. Users of all skill levels now have a single
console for managing objects, creating and debugging stored procedures,
generating optimized SQL, and benchmarking performance for DB2 running
on LUW and z/OS. Skills migration is effortless for developers and DBAs who
are familiar with Toad on other database platforms.

Figure 1: Connection manager allows simple log-on to DB2 z/OS and LUW
environments

8
REFERENCING OBJECTS: THE DEVELOPER’S
PERSPECTIVE
When developers develop a new DB2 application, they need to reference
objects such as tables, views, indexes, synonyms, and aliases from the DB2
catalogue. In the early days of DB2, developers typically used the SQL
processing using file input (SPUFI) query facility. This 3270 based-tool
enables users to code and execute queries dynamically. Referencing objects
requires a fairly high level of mainframe navigation knowledge -- well beyond
the scope of the typical Windows developer. Nowadays, the ideal scenario
would offer a Windows interface, which allows developers to view the listed
objects, and build their SQL calls directly in context from the objects.
Instead of requiring the manual coding of the SQL calls, this eliminates the
time-consuming need for the DBA to run reports listing the objects.

Database Browser
Toad’s database browser provides an intuitive interface for accessing all
information stored in the DB2 catalog. Developers have easy access to
column structures, indexes, views, referential integrity, and other features.
Users can apply filters to all object levels to display only relevant information.

Figure 2: Database browser provides easy access to all relevant catalog information

9
Accessing Data: It’s More Than Just Writing a SELECT
Statement
Developers require a realistic sampling of data to adequately test their
applications as they develop new ones. The native facilities available in DB2
are limited to JCL batch jobs which run IBM’s DSNTIAUL program or the
UNLOAD utility to dispatch data. The UNLOAD utility would need to facilitate
a batch LOAD job to import the data into test tables. This goes beyond the
abilities of the typical GUI developer. Once again, it may require the DBA’s
involvement to run these jobs. A simple point/click method to export/import
data is ideal. Another good feature for developers is the data editor. This
allows the developer to manipulate the test data for specific test cases.
These types of tools are commonly available for Unix-based DBMSs such as
Oracle and SQL Server, but are hard to find for the z/OS platform.

Toad for DB2 provides robust functionality for manipulating test data:

Figure 3: Simple to use data-editing interface

10
Fig 4: Simply drag a column into the blue window to group data

Data Editor
The data editor function allows you to easily view and manipulate data by
simply keying over a data value. It also fully supports LOB data. The drag-
and-drop GROUPBY feature makes it easy to organize data for simpler
viewing.

11
Export Wizard
The Export wizard extracts data and places it in to multiple formats, such as
comma delimited, XML, HTML, or Excel.

Fig 5: Export wizard allows exporting of data to multiple formats

Master Detail Browser


The master detail browser displays a parent row and all its related child rows
in a referentially tied table.

Fig 6: Master detail browser

12
BUILDING AND TESTING SQL CALLS FOR THE
MAINFRAME
A solid understanding of SQL fundamentals is the most critical factor in the
application development lifecycle. A SQL statement can be coded in
hundreds of ways and achieve the same result set with drastically different
performance. Many developers with rudimentary knowledge of SQL need
help with syntax and proper coding rules of thumb. The proper education is
essential for developers in the explanation process to interrogate their
queries and ensure effective coding. If overlooked in the application
lifecycle, poorly written SQL calls will require DBA intervention when
programs go into production. Once the SQL calls are built and tuned,
developers should test them in a realistic environment to avoid performance
issues that may arise when applications move to production. Many novice
mainframe developers have a “desktop” mentality and are used to dealing
with small Unix- or Windows-based databases. The common mistake is to
test an application with limited data or an unrealistic user load. This leads to
programs crashing when exposed to the typical transaction and data volumes
of a production mainframe.
Toad for DB2 provides deep SQL development functionality, including
automated SQL generation, syntactical help, customizable SQL templates,
and integration with SQL optimization, and scalability testing tools.

13
SQL Modeler
The SQL Modeler option allows you to easily build SQL statements directly
from a selected table. Window drop-down menus display aggregate
functions and sort options for completing the SQL structure. You can select
multiple tables to generate complex constructions. Generated queries can be
reviewed, executed and explained.

Figure 7: Building a join statement with SQL Modeler

Query Editor
The Query Editor provides a robust facility for generating, formatting, and
testing a query. You can free-form write a query or import it in from a file.
Several shortcut functions help you to generate new queries, such as code
snippets (syntax generators) and customizable templates for automatically
producing specific lines of code. The tool can also generate syntax to embed
SQL into applications written in C++, Delphi, Pearl, or JAVA code.

Figure 8: Functionality available in the Query Editor

14
Building SQL
With the Query Editor window, you can free-form write SQL, import from a
file, and use the available shortcut commands such as code snippets and
auto-replace templates.

Figure 9: Using the query builder option to generate SQL

Figure 10: Code snippets provide shortcuts to generating syntax

15
Optimizing SQL
There are two options for optimizing DB2 z/OS SQL within Toad.
Standard Explain – Built into Toad, the standard explain provides an
animated visual display of the access path in multiple formats.

Fig 11: Built-in animated explain display

16
Advanced Explain – The advanced explain utilizes the z/OS SQL tuning
module from Quest Central for DB2. This module provides a detailed
overview of the access path, catalog statistics, and interactive tuning with
the SQL compare feature.

Figure 12: Advanced explain

Figure 12: “Scenario” compare for interactive tuning

17
CONCLUSION
Once thought to face extinction, the mainframe now provides the backbone
of data processing power for very complex distributed environments. The
need to rewrite legacy green screen applications or to create completely new
ones to address the modern day business need results in a shortage of
mainframe programming expertise. Developers with disciplines other than
the DB2 mainframe need a complete set of productivity tools for accessing
mainframe objects, building efficient SQL, and performing pre-production
stress testing.

18
ABOUT THE AUTHOR
Jim Wankowski is the DB2 Technology Specialist at Quest Software. He has
over 20 years of development and DBA experience with DB2. Jim participated
in the original beta program for DB2 in 1984 and is well known in the DB2
community. He has written articles for DB2 Magazine, and regularly presents
at IDUG conferences, regional DB2 user groups, and vendor seminars
worldwide.

19
ABOUT QUEST SOFTWARE, INC.
Quest Software, Inc. delivers innovative products that help organizations get
more performance and productivity from their applications, databases and
Windows infrastructure. Through a deep expertise in IT operations and a
continued focus on what works best, Quest helps more than 18,000
customers worldwide meet higher expectations for enterprise IT. Quest’s
Windows Management solutions simplify, automate and secure Active
Directory, Exchange and Windows, as well as integrate Unix and Linux into
the managed environment. Quest Software can be found in offices around
the globe and at www.quest.com.

Contacting Quest Software


Phone: 949.754.8000 (United States and Canada)
Email: info@quest.com
Mail: Quest Software, Inc.
World Headquarters
5 Polaris Way
Aliso Viejo, CA 92656
USA
Web site www.quest.com
Please refer to our Web site for regional and international office information.

Contacting Quest Support


Quest Support is available to customers who have a trial version of a Quest
product or who have purchased a commercial version and have a valid
maintenance contract. Quest Support provides around the clock coverage
with SupportLink, our web self-service. Visit SupportLink at
http://support.quest.com

From SupportLink, you can do the following:

Quickly find thousands of solutions (Knowledgebase articles/documents).


• Download patches and upgrades.
• Seek help from a Support engineer.
• Log and update your case, and check its status.

View the Global Support Guide for a detailed explanation of support


programs, online services, contact information, and policy and procedures.
The guide is available at: http://support.quest.com/pdfs/Global Support
Guide.pdf

20

Вам также может понравиться