Just a brief blog post today to promote my upcoming speaking engagement at the New England DB2 User Group, in Sturbridge, MA (just outside of Boston). If you are in or around the area on June 18, 2015 be sure to stop by and participate in the meeting!
I will be giving two presentations (in the afternoon) that day. First up is my Big Data introductory presentation titled A Big Data Roadmap for the DB2 Professional. This was voted one of the Top Ten presentations at IDUG North America in 2014. My second presentation is a little bit different than what I normally present. It is titled Reduce Costs by Tuning DB2 to Reduce Your Rolling 4 Hour Average and in it I will walk through the components of subcapacity pricing and variable workload license charge... and how to use that knowledge to tune and reduce your monthly mainframe costs.
There are two other speakers that day, including a pitch from IBM on migrating to DB2 11 for z/OS and another presentation from the State of CT on IBM's PureData system.
So if you are going to be in the New England area be sure to put the NEDB2UG meeting on your agenda.
Hope to see you there!
Tuesday, June 09, 2015
Monday, June 01, 2015
DB2 User-Defined Functions
In my last post here, I
talked about the importance of built-in DB2 functions and how they can be used
to simplify development. But DB2 also allows us to create our own, user-defined
functions to programmatically extend the functionality of DB2.
A user-defined function, or
UDF for short, is procedural functionality that you code up and add to DB2. The
UDF, after coded and implemented, extends the functionality of DB2 SQL by
enabling users to specify the UDF in SQL statements just like built-in SQL
functions.
User-defined functions are
ideal for organizations wanting to utilize DB2 and SQL to perform specialized
routines with your own rules, business logic and data transformation procedures.
UDFs are similar in
functionality to application subroutines, but user-defined functions are
different because they can be used inside SQL statements. The only way that
user-defined functions can be executed is from within an SQL statement. This
gives them great power. A user-defined function is not a substitute for an
application subroutine, subprogram, or procedure. Instead, user-defined
functions extend the functionality of the SQL language.
There are two basic ways to
create a user-defined function: You can code your own program from scratch
(using either a host programming language or SQL) or you can edit an existing
function. When coded, the CREATE FUNCTION statement registers the user-defined function to DB2 for use.
Types
of User-Defined Functions (UDFs)
DB2 supports five different
types of UDFs depending upon the manner in which they are coded and the type of
functionality they support.
- The first type is the external scalar UDF. Recall, from the prior post, that scalar functions are applied to a column or expression and operate on a single value. Furthermore, external functions are referred to as external because they are written and developed outside of (or external to) DB2. External UDFs must be written in a host programming language. DB2 user-defined functions can be written in Assembler, C, C++, COBOL, Java, or PL/I.
- The next type of UDF is the external table UDF. Remember that table functions, when called, return an entire table. A table function is specified in the WHERE clause of a SELECT statement taking the place of a table, view, synonym, or alias.
- A third type of user-defined function can be created from another existing function. This is a sourced function. A sourced function is based on a function that already exists -— it can be based on a built-in function (scalar or column) or another user-defined function that has already been created. External functions are coded from scratch, whereas sourced functions are created based on a pre-existing function and inherit the attributes of the underlying source function.
- DB2 also supports the creation of SQL scalar user-defined functions. SQL scalar functions return a scalar value and are written entirely using SQL. Fairly extensive functionality can be delivered via SQL scalar functions using SQL procedural language.
- The fifth, and final type of UDF supported by DB2 was introduced as of DB2 10 for z/OS: the SQL table UDF. SQL table functions are written exclusively in SQL but return a table as a result.
There are a lot of details
involved in coding and using UDFs, such as schema management, configuring WLM
for execution, SQL restrictions, and more. But I will not be digging into those details in today’s
post. I invite you to research the topic and learn how to extend the
functionality of your DB2 environment using UDFs.
Tuesday, May 19, 2015
The Importance of Using DB2 Functions
There are three basic types of built-in functions available to DB2 users:
- aggregate functions,
- scalar functions, and
- table functions.
It is important
that you understand what functions are available – as well as what they do – in
order to simplify program development and data access. Functions are invoked simply
by specifying the function name and any required operands. A built-in function
can be used any place an expression can be used (with some exceptions).
The first type of
function is called an aggregate function, or
sometimes a column function.
Aggregate functions can be used to
compute, from a group of rows, a single value for a designated column or
expression. This provides the capability to aggregate data, thereby enabling
you to perform statistical calculations across many rows with one SQL
statement.
An aggregate function can be
specified in a WHERE clause only if that clause is part of a subquery of a HAVING clause. In addition, every
column name specified in the expression of the aggregate function must be a
correlated reference to the same group.
The aggregate functions are AVG, CORRELATION, COUNT, COUNT_BIG, COVARIANCE, COVARIANCE_SAMP, MAX, MIN, STDDEV, SUM, VARIANCE, and XMLAGG.
I won’t be explaining what
each of these functions does in today’s blog entry; instead, I suggest that you
review their functionality in the SQL Reference Guide (SC19-4066 for DB2 11 for
z/OS).
The second type of
function is the scalar function, which is probably the most commonly used type
of function. However, there are so many scalar functions that it can be
difficult to keep track of them all. A scalar function is applied to a column or expression and operates on a single value.
Contrast this with the aggregate functions, which are applied to a set of data
and return only a single result.
The result of a scalar
function is a transformed version of the column or expression being operated
on. The transformation of the value is based on the scalar function being
applied and the value itself. For example, you might use the CHAR function to
convert a DB2 date, time, timestamp, ROWID, floating point, integer, or decimal
value to a character value… or you might use the DIGITS function to convert a
number to a character string of digits.
Of course, these are just a
few simple examples of the many functions available in DB2 for z/OS. There are well
over 100 scalar functions, each of which may be useful to minimize the amount
of code you write by making DB2 do it, instead!
With so many functions
available it would not make sense to cover them all here. Suffice it to say, by
acquiring a sound understanding of DB2’s functions many requirements that seem to
be difficult at first glance, are achievable using nothing more than SQL (check
out this example to clarify what I mean: Sorting Out a Solution in DB2).
The third type of function
supported by DB2 is the table function, which can be specified only in the FROM clause of a query. This is
because table functions return columns and resemble a table. There are three basic table functions:
- ADMIN_TASK_LIST: Returns a table with one row for each defined task in the administrative scheduler task list. The administrative scheduler is covered in Part VI, “DB2 Utilities and and Commands.”
- ADMIN_TASK_OUTPUT: For an execution of a stored procedure, returns the output parameter values and result sets, if available.
- ADMIN_TASK_STATUS: Returns a table with one row for each defined task in the administrative scheduler task list, showing the status of the task the last time it was run.
Additional Useful Function Information
DB2 also offers some other types of built-in functions including:
- MQSeries Built-In Functions - scalar and table functions for use with IBM’s message queuing software, MQSeries. These functions enable MQSeries messages to be received and sent.
- XML Built-In Functions - scalar functions to allow applications to efficiently generate and manipulate XML data with DB2.
The final built-in function to be aware of is the
RAISE_ERROR
Function. It is used to raise an error
condition in the SQLCA. The user supplies the SQLSTATE and error description for the error to be raised. The error will
be raised with the specified SQLSTATE and a SQLCODE of –438. The RAISE_ERROR function can be used to signal application program and data
problems.
What About User-Defined Functions?
DB2 also supports the creation of additional functions (and data
types) to supplement the built-in function (and data types) supplied
out-of-the-box. User-defined functions (and types) give users the ability to
effectively customize DB2 to their shop requirements. The ability to customize
is potentially very powerful. It also can be quite complex and requires
detailed knowledge, additional application development skills, and
administrative dexterity.
We will take a look at UDFs in
the next blog post, so check in again next week for that!
Tuesday, May 12, 2015
A Trip Report from the 2015 IDUG DB2 Tech Conference
Last week I attended, and spoke at, the annual North
American IDUG DB2 Tech Conference in Philadelphia, PA. As usual, the event was busy
and chock full of useful and interesting DB2 information.
My week started on Sunday with the IBM gold consultant briefing,
whereby IBM talks to the gold consultants about their upcoming plans and
solicits feedback from us. I can’t really share with you what happened there,
but as is almost always the case, it was time well spent.
The conference kicked off in earnest on Monday
with the keynote from IBMers Tim Vincent and Namik Hrle titled “Big Data,
Analytics and the Future of Data Management.” Tim and Namik discussed
how the growth of data is fueling innovation causing a big change in the way
value is created. Some of the key takeaways from the keynote, for me at least,
were:
- The predominant source of Big Data for most projects is still structured transactions
- Primary focus of most data projects is usually on understanding customers
- There is a trend toward self-service
- Clearly there is value in Hadoop but you can't replace all your DBMSes with it!
Perhaps the most salient tidbit shared at the keynote address
was this: “People have forgotten, or never truly understood, how complex data
integration actually is.” I think this is true; all too often people
underestimate how difficult the integration of data will be. And I agree, too,
with sentiment of the presenters who declared that “We need to realize that
data is never going to be in one place.”
The bottom line of the keynote: All of our existing DB2 skills
will still be relevant but must co-exist with skills in newer technologies like
NoSQL and Hadoop.
Good stuff!
Some of the other highlights of the week:
- Attendance seemed to be higher than at the past few IDUG
conferences. And I see growth in the number of DB2 for LUW attendees. IDUG, at
least historically, was mostly attended by DB2 for z/OS folks. And it is
probably still true that more z/OS folks attend than LUW folks, but the LUW
attendance continues to grow and may surpass z/OS at some point! Of course, this
is all based on my unscientific eyeballing of attendees at presentations.
- My session on DB2 performance had a full room and nobody
seemed to nod off or run for the exits while I spoke. I also delivered a VSP for Dell to a room full of DBAs and developers, as well as a couple of presentations for DataKinetics during an evening session. So that was all good!
- I attended a couple of sessions on newer features of DB2 and
how some of them are under-utilized. I think this speaks to a few trends
hitting the world of DB2 these days. Number one: training is drying up. If you
don’t get training on new features it is hard to use them appropriately. Number
two: failure to take advantage of free learning opportunities like webinars and
freely-available PDF manuals:
- The vendor exhibit hall was active and well-attended
throughout the week. All the usual suspects were there like BMC, CA, dbi, Dell,
and IBM, but there were some newer (at least to IDUG) companies, too, like
DataKinetics and Imperva.
- The educational seminars were integrated into the conference this year. And they did not cost extra to attend. That means that more people attended ed seminars this year (at least I think they did) and the conference offered more value to attendees looking for more in-depth education than can be gained by an hour session.
All in all, the 2015 North American IDUG Tech Conference was
a big success. And it is not too early to start planning for next year’s
conference, which will be in Austin, TX. Finally, I’ll be able to drive to an
IDUG… see you there in 2016!
Tuesday, April 28, 2015
Controlling Mainframe Software Costs
Although this blog usually focuses on DB2 issues, I sometimes use it to focus on other IT issues, usually mainframe-related. The primary purpose of today's blog post is to promote a webinar I'm conducting this Thursday called, Managing Your z/OS Software Bill. The webinar is sponsored by Data Kinetics, the North American distributor of a product called AutoSoftCapping (or ASC for short), that can be used to help control the rolling four hour average and thereby reduce monthly software bills.
Cost containment is of critical importance for IT departments in this day and age of financial austerity... especially so in the mainframe world. Every decision regarding your computer resources is weighed based on not only the value that they can deliver to your organization, but upon their cost to procure, implement, and maintain. And, in most cases, if a positive return on investment cannot be calculated, the software won’t be adopted, or the hardware won’t be upgraded.
Cost containment is of critical importance for IT departments in this day and age of financial austerity... especially so in the mainframe world. Every decision regarding your computer resources is weighed based on not only the value that they can deliver to your organization, but upon their cost to procure, implement, and maintain. And, in most cases, if a positive return on investment cannot be calculated, the software won’t be adopted, or the hardware won’t be upgraded.
An important opportunity for mainframe cost containment is to better manage the peak monthly capacity of your mainframe on an LPAR (logical partition) by LPAR basis. The pricing model for most mainframe software is based on the capacity of the machine on which the software will run. Note that this pricing model reflects the potential usage based on the capacity of the machine, not the actual usage. Some vendors offer usage-based pricing. You should actively discuss this with your current ISVs as it is becoming more common, more accurately represents fair usage, and can save you money.
IBM offers several subcapacity pricing models for many of its popular software offerings, including products such as z/OS, DB2, IMS, CICS, MQSeries and COBOL. Some of the benefits of subcapcity pricing include the ability to:
- Grow hardware capacity without necessarily increasing your software charges
- Pay for key software at LPAR-level granularity
- Experience a low cost of incremental growth
- Manage software cost by managing workload utilization
By tracking MSU usage by LPAR you can be charged based on the maximum rolling four hour (R4H) average MSU usage, instead of full capacity. Most organizations with mainframes have shifted to some form of subcapacity pricing model, but not all of them understand how all of the "moving parts" work together. Thursday's webinar will help to clear that all up!
Managing mainframe software costs by adopting subcapacity pricing, soft capping techniques, and software like Data Kinetics' AutoSoftCapping can help your company to assure a cost-effective IT organization. In today’s cost-cutting, ROI-focused environment, doing anything less than that is short-sighted.
Managing mainframe software costs by adopting subcapacity pricing, soft capping techniques, and software like Data Kinetics' AutoSoftCapping can help your company to assure a cost-effective IT organization. In today’s cost-cutting, ROI-focused environment, doing anything less than that is short-sighted.
Subscribe to:
Posts (Atom)