What's so exciting about DB2 Native SQL Procedures?



Similar documents
CA Insight Database Performance Monitor for DB2 for z/os

Version Overview. Business value

zenterprise The Ideal Platform For Smarter Computing Developing Hybrid Applications For zenterprise

DB2 Connect for NT and the Microsoft Windows NT Load Balancing Service

IMS Buzz - Mardi 10 Avril IMS Explorer for Dev Presentation & Demo

Building Applications Using Micro Focus COBOL

Virtual Machines.

Adabas und Natural für das Digitale Unternehmen

Take full advantage of IBM s IDEs for end- to- end mobile development

IBM Tivoli Composite Application Manager for WebSphere

New Security Options in DB2 for z/os Release 9 and 10

Why is CICS Still Alive? Dr Geoff Sharman Visiting Professor in Computer Science Birkbeck College

Java on z/os. Agenda. Java runtime environments on z/os. Java SDK 5 and 6. Java System Resource Integration. Java Backend Integration

Keeping Databases in Sync during migration from z/os to a distributed platform

DevOps: Multiplatform Application Deployment

CA IDMS Server r17. Product Overview. Business Value. Delivery Approach

INTRODUCTION ADVANTAGES OF RUNNING ORACLE 11G ON WINDOWS. Edward Whalen, Performance Tuning Corporation

CICS Transactions Measurement with no Pain

How To Write An Ets Request For Proposal (Rfp)

CA JCLCheck Workload Automation

PROGRESS DATADIRECT QA AND PERFORMANCE TESTING EXTENSIVE TESTING ENSURES DATA CONNECTIVITY THAT WORKS

IBM InfoSphere MDM Server v9.0. Version: Demo. Page <<1/11>>

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Exam Name: IBM InfoSphere MDM Server v9.0

CA SYSVIEW Performance Management r13.0

Data Warehousing With DB2 for z/os... Again!

DBAs having to manage DB2 on multiple platforms will find this information essential.

x86 ISA Modifications to support Virtual Machines

How To Write A Windows Operating System (Windows) (For Linux) (Windows 2) (Programming) (Operating System) (Permanent) (Powerbook) (Unix) (Amd64) (Win2) (X

DeBruin Consulting. Key Concepts of IBM Integration Broker and Microsoft BizTalk

Eloquence Training What s new in Eloquence B.08.00

Chapter 1 - Web Server Management and Cluster Topology

Field Developed Solution Catalog. Version 7.0

Enterprise Report Management CA View, CA Deliver, CA Dispatch, CA Bundl, CA Spool, CA Output Management Web Viewer

Redbooks Paper. Local versus Remote Database Access: A Performance Test. Victor Chao Leticia Cruz Nin Lei

Introducing Micro Focus Net Express to Develop and Extend COBOL Applications within.net White Paper

SQL Stored mutsoc.be. socmut.be. GSE DB2, Leuven 28/11/2013. NVSM - Inf.Dir.Inf. - System MF - Page 1

Tune That SQL for Supercharged DB2 Performance! Craig S. Mullins, Corporate Technologist, NEON Enterprise Software, Inc.

Improve your IT Analytics Capabilities through Mainframe Consolidation and Simplification

DB2 Application Development and Migration Tools

LES LOGICIELS MAINFRAME

Evolution of IMS to a complete Enterprise solution

SQL Server Business Intelligence on HP ProLiant DL785 Server

Key Metrics for DB2 for z/os Subsystem and Application Performance Monitoring (Part 1)

CHAPTER 15: Operating Systems: An Overview

Cloud Computing and Advanced Relationship Analytics

UPSTREAM for Linux on System z

data express DATA SHEET OVERVIEW


WJEC GCSE in Computer Science Computer Science Microsoft IT Academy Mapping

Application Development Guide: Programming Server Applications

Zend and IBM: Bringing the power of PHP applications to the enterprise

PASS4TEST 専 門 IT 認 証 試 験 問 題 集 提 供 者

Information Systems. Capacity Planning Monthly Report

IBM Communications Server for Linux - Network Optimization for On Demand business

Bruce Momjian June, Postgres Plus Technical Overview

IBM WebSphere Operational Decision Management Improve business outcomes with real-time, intelligent decision automation

AD04 - Batch Modernization Strategies for Mainframe Environments

How to use PDFlib products with PHP

Developing a dynamic, real-time IT infrastructure with Red Hat integrated virtualization

Big Data Storage in the Cloud

Rational Application Developer Performance Tips Introduction

Database Auditing and Compliance in a Mainframe Environment. Craig S. Mullins, Corporate Technologist, NEON Enterprise Software, Inc.

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

VMWARE WHITE PAPER 1

Chapter 2: Remote Procedure Call (RPC)

iseries Logical Partitioning

GETTING STARTED GUIDE

Predictive Analytics And IT Service Management

Java DB2 Developers Performance Best Practices

IBM Business Monitor Version IBM Business Monitor Installation Guide

Microsoft SQL Server versus IBM DB2 Comparison Document (ver 1) A detailed Technical Comparison between Microsoft SQL Server and IBM DB2

ClearPath MCP Developer Studio

Micro Focus Database Connectors

AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping

Maximizing Cross-Platform Application Availability

IBM Software Group. Lotus Domino 6.5 Server Enablement

Rocket AS v6.3. Benefits of upgrading

CROSS PLATFORM AUTOMATIC FILE REPLICATION AND SERVER TO SERVER FILE SYNCHRONIZATION

CA Workload Automation Agents Operating System, ERP, Database, Application Services and Web Services

Improve SQL Performance with BMC Software

Client/Server Computing Distributed Processing, Client/Server, and Clusters

CA Aion Business Rules Expert 11.0

DevOps for the Mainframe

Virtualization: What does it mean for SAS? Karl Fisher and Clarke Thacher, SAS Institute Inc., Cary, NC

CA Datacom /DB Version 14.0

Data Centers and Cloud Computing

Server and Storage Virtualization. Virtualization. Overview. 5 Reasons to Virtualize

Chapter 2 TOPOLOGY SELECTION. SYS-ED/ Computer Education Techniques, Inc.

MySQL databases as part of the Online Business, using a platform based on Linux

Operating Systems, 6 th ed. Test Bank Chapter 7

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2007 Lecture 5 - DBMS Architecture

Data Sheet VISUAL COBOL WHAT S NEW? COBOL JVM. Java Application Servers. Web Tools Platform PERFORMANCE. Web Services and JSP Tutorials

Enterprise Data Solutions Product Strategy and Vision Process-driven IT Modernization, Natural and Adabas

z/os Curriculum Job Control Language (JCL) Curriculum JES Curriculum WebSphere Curriculum TSO/ISPF for z/os Curriculum

Berlin Mainframe Summit. Java on z/os IBM Corporation

Transcription:

DB2 Native Procedures: Part 1. What's so exciting about DB2 Native Procedures? This is a question I've been asked countless times. I can't help it, they excite me. To me they truly represent the future of computing. To put it in perspective think about your current development environment. How many lines of application code are you attempting to support with fewer and fewer experienced developers to maintain that code? Have you tried lately to hire a developer that knows COBOL, JCL, TSO, VSAM, or any of the skills it takes to develop traditional mainframe applications? Try doing a search on application development; know what comes up? " Experts in Web, Mobile and Desktop development" or "certified PHP, java,.net web developers" and don't forget " RAD, Rapid application development that uses minimal planning in favor of rapid prototyping". Well, the problem is my data lives, quite happily I might add, on an IBM System Z in DB2 databases. Why you might ask? It handles the terabytes of data required efficiently, securely, 24/7 and with full recoverability. Now, how to continue providing access to that information anywhere, anytime with minimal overhead and cheaper than ever before? Thus, Native Procedures EXCITE ME! Now, let's take a look at DB2 PL. DB2 Procedural Language ( PL) is a subset of the Persistent Stored Modules (/PSM) language standard. This standard is the basis for the structured programming languages used with to write stored procedures, functions, triggers, and standalone code. Encapsulating complex business logic in database stored procedures can yield the following benefits: Significantly improved application performance Increased application scalability Simplified application development Reduced network traffic The /PSM standard combines the ease of data access with the flow control structures of a simple programming language. It gives developers the ability to create compound statements and procedures that only need to be coded once to run on multiple platforms. You can write PL code that can run on DB2 for Linux, UNIX, Windows, i5/os, and z/os which improves the portability of your code. In addition, IBM supplies Eclipse based development tools that allow you to code, test, deploy, tune and debug your Native Procedure from your desktop. Most Mid-tier or

desktop developers can be brought up to speed in a few days. No need to retrain on mainframe tools. In fact, I downloaded the free version of Data Studio from IBM's web site, installed it and had my first, very simple, Native Procedure coded and tested in less than 6 hours. Nice! Thank you IBM! So how do Stored Procedures work? Let's take a look at how it all started. DB2 External Stored Procedures are user written application programs, usually COBOL, that are compiled, linked and cataloged into a load library that is made available to a stored procedure WLM address space. The BIND of the DBRM ( Statements) is performed and an Administrator executes the CREATE PROCEDURE statement to define the procedure to DB2. External Stored Procedures z/os ssiddist ssiddbm1 WLM Address Space(s) CONNECT TO ssid CALL SP1 (val1,val2, ) DB2 TCP/IP Interface Data SP1 Load Mod Figure 1. External Stored Procedure Environment When a requesting application calls the Stored procedure from a local or remote location, as shown in Figure 1. the DB2 Data Base Services Address Space (DBM1) must look up the procedure in the SYSIBM.SYSROUTINES catalog table, acquires an available TCB to be used by the stored procedure and the stored procedure address space is notified to execute the stored procedure. If the procedure is not resident in the WLM address space it will be loaded from the load library. Control is then passed to the stored procedure, the stored procedure executes and

when an statement is encountered control is passed back to the DBM1 address space to execute the bound package for the data access, and the result is passed back to the Stored procedure address space. When the Stored Procedure eventually completes control is returned to the DBM1 address space and the final result is passed back to the Caller. In Version 5 of DB2 IBM introduced Procedures. Today we refer to these procedures as External Procedures. External Procedures removed the host language requirement. The Procedures could be coded in it's entirety with the CREATE PROCEDURE statement. No host language coding skill required. However, the CREATE statement, with the definition information, statements and procedural code must converted to a host language application. Once the External procedure is coded you can use the workbench tool set or execute the DSNH procedure to translate the CREATE statement into a C language program and perform normal External Stored Procedure preparation. External C programs run in WLM address spaces just like any other External Stored Procedure. Example: CREATE PROCEDURE MYRAISE ( IN P_EMPNO CHAR(6), IN P_RAISEPCT DEC(6,2) ) LANGUAGE UPDATE EMP SET SALARY = SALARY * (1 + P_RAISEPCT/100) WHERE EMPNO = P_EMPNO; DB2 V9 introduced a new kind of Procedure, the Native Procedure. Unlike the original External Procedures, there is no need to translate the procedure into a host language. When the CREATE PROCEDURE statement is executed DB2 inserts the definition information into the DB2 Catalog, With V9 new function mode, when you create a native procedure, its procedural statements are converted to a native representation that is stored in the DB2 catalog and directory, as it is done with other statements, it is bound into a DB2 package. The parameter list and procedure options are stored in the database catalog tables as in the prior releases. When you CALL a native procedure, DB2 loads the native representation(package) from the directory and the DB2 engine

executes the procedure. No WLM required! Everything is stored in the package, under DB2 Control. Native Procedure Execution CALL SP3N DB2 DIRECTORY SP3N: EDM SP3N DB2 DBM1 PL native logic SPT01 PL native logic DDF DB2 CAT SYSROUTINES SYSPARMS SYSPACKAGE SYSENVIRONMENT CALL SP3N Figure 2. Native Procedure Execution. Native Procedures are simply packages, with "runtime structures" for the statements to be executed. So, when you invoke a native procedure, DB2 finds and loads the package and executes the statements. Example: CREATE PROCEDURE SPA80 (OUT p_cnt1 SMALLINT,OUT p_sumsal DECIMAL(11,2),OUT p_code INTEGER ) VERSION V1 ISOLATION LEVEL CS VALIDATE BIND QUALIFIER THEMIS1 RESULT SETS 0 LANGUAGE P1: BEGIN DECLARE CODE INTEGER DEFAULT 0; SELECT COUNT(*), SUM(SALARY) INTO p_cnt1, p_sumsal FROM EMP; SET p_code = CODE; END P1

Performance Your Code!! Network Issues DB2 Issues Internals DDF DDF SHR ziip? DB2 DBM1 Network & DB2 Connect WLM Figure 3. Native Procedures and Performance Unlike external stored procedures, native stored procedures do not execute in a WLM address space. WLM is only required for debugging. With Native procedure everything runs under the caller s task when the stored procedure is called, the caller s DB2 thread just switches to the procedures package; No queuing, no delays and reduced dispatch overhead. Native procedures are ziip-eligible when called via DRDA. Work that runs on the ziip does not incur software charges based on the service units consumed; therefore it is a very attractive lower-cost alternative to running workloads on a general purpose processor. With the ziip capability, the System z9 or System z10 mainframes help minimize the need to maintain duplicate copies of data. This eliminates the need to pass the data between DBM1 and the DDF address space. For server threads that process requests from applications that access DB2 by TCP/IP, a portion of the SP executes under a dependent enclave SRB if it processes on behalf of an application that originated from an allied address space, or under an independent enclave SRB if the processing is performed on behalf of a remote application that accesses DB2 by TCP/IP. Shared memory is a relatively new type of virtual storage that allows multiple

address spaces to easily address common storage that is introduced in z/os 1.5. It is similar to ECSA, since it is always addressable and no address register mode or cross memory moves are needed. It is different from ECSA since it is not available to all address spaces on the system. Only those that are registered with z/os as being able to share this storage have visibility to this storage. Shared memory resides above the 2 GB bar. As you can see, Native Procedures are Exciting! They are simple to develop, easy to deploy, are cross platform compliant and on the z Server perform very well and are "Cost Effective" Part 2. Experiences in Implementing Native Procedures Linda F. Claussen A frequent speaker at conferences and user groups, Linda's 30+ years of experience spans the various roles of application developer, project manager, Data Base Administration and Systems Programmer. She has frequently worked with new DB2 sites performing the initial DB2 install, providing training and consulting to the Project Leaders, DBAs and Application staff responsible for the initial DB2 pilot project and conducting performance design reviews to insure successful project implementation. Linda is a past member of the IBM DB2 GOLD Consultants program and past IDUG conference chair. Linda currently works for Themis, Inc. as a DB2 for z/os consultant and technical trainer and is a current member of the IBM Consultant Advisory Council. She can be reached at: http://www.themisinc.com lclaussen@themisinc.com US 1-800-756-3000