To Bind Or Not To Bind – Let Bind Manager Decide

1,059 views
945 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,059
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
30
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

To Bind Or Not To Bind – Let Bind Manager Decide

  1. 1. Session: To Bind Or Not To Bind – Let Bind Manager Decide Joe Goodman DST Systems Inc. May XX, 2008 • 00:00 a.m. – 00:00 a.m. Platform: DB2 for z/OS IBM’s Bind Manager for DB2 z/OS can save your organization time and money by providing a mechanism for avoiding unnecessary binds. This can result in fewer production outages as well as saving time and effort in the development cycle. This presentation will focus on how it works, how to implement it, and how to measure the benefits. 1
  2. 2. Topics for this presentation • The Main Functions of Bind Manager • DB2 program preparation for bind avoidance • Implementing Bind Avoidance • Measuring the cost & effect • Additional utilities 2 2
  3. 3. About DST Systems http://www.dstsystems.com •Leading provider of computer software solutions and services, NYSE listed – “DST” •Revenue $2.24 billion •110 million+ shareowner accounts •24,000 MIPS •150 TB DASD •145,000 workstations •462,000 DB2 objects •Non-mainframe: 600 servers (DB2, Oracle, . Sybase, SQL Server) with 2.3 million objects 3 If you have ever invested in a mutual fund, have had a prescription filled, or are a cable or satellite television subscriber, you may have already had dealings with our company. DST Systems, Inc. is a publicly traded company (NYSE: DST) with headquarters in Kansas City, MO. Founded in 1969, it employs about 12,000 associates domestically and internationally. The three operating segments - Financial Services, Output Solutions and Customer Management - are further enhanced by DST’s advanced technology and e- commerce solutions. 3
  4. 4. Disclaimer • The details presented in this presentation may not apply to all installations (your mileage may vary) 4 All installations are different in some respects. The statistics gathered benchmarking the performance of the various products are unique to DST. While effort was made to ensure that the benchmarks taken give a true representation of product performance, it is no guarantee that your results will be similar. Everyone interested is urged to try the product for themselves in their own environment. 4
  5. 5. Terms • For purposes of this discussion, we’ll use a few shortcuts in terminology. Unless explicitly stated otherwise… • Compile refers to the complete program preparation cycle • DB2 refers to DB2 for z/OS V7 or later • Bind Manager refers to DB2 Bind Manager for z/OS V2.3 5 5
  6. 6. Bind Manager – The Main Functions • Bind Avoidance • DBRM Library Maintenance • DB2 Catalog Maintenance 6 Bind Manager is a set of programs that allow the user to bypass the Bind step when program changes do not require changes to the SQL Bind Manager also includes a set of utilities to be used in both batch and online (ISPF) mode that allow you to – Browse a DBRM Cross Reference Load libraries, DBRM libraries, and the DB2 catalog Generate a DBRM from the DB2 catalog Cleanup obsolete plans and packages 6
  7. 7. Bind Avoidance: Why ? • Catalog Concurrency Issues • Access path switches • Additional time required for program installs 7 Catalog concurrency issues: Multiple binds running simultaneously can create deadlocks on the DB2 catalog. Application deadlocks are a nuisance and sometimes a serious problem. Catalog deadlocks are always a serious problem and sometimes a disaster. Access Path Switches: The DB2 Optimizer isn’t perfect. Unexpected access path switches still occur. These can play havoc with production cycles when they occur. Avoiding the bind eliminates the possibility of a switch. Additional time required for program installs: Executing binds adds additional time and complexity to the install process. 7
  8. 8. Catalog tables effected by binds • Package Binds: • SYSPACKAGE • SYSPACKDEP • SYSPACKSTMT • SYSPACKAUTH • SYSPACKLIST • Plan Binds • SYSPLAN • SYSDBRM • SYSSTMT • SYSPLANDEP • SYSPLANAUTH 8 Though greatly diminished, catalog contention still occurs in our environment. SYSPACKSTMT, SYSPACKDEP, SYSSTMT and SYSPLANDEP can have large numbers of rows added/replaced. During a large install of new program code, the chances of contention are greatly increased. 8
  9. 9. The old program preparation process Source Pre-Compile Modified Source Compile DBRM Object Link-Edit Load Bind DB2 Catalog 9 Program Preparation without Bind Manager: Source Statements input to pre-compiler Two pre-compile outputs: DBRM and Modified Source (Both contain contoken) RC=0 for perfect pre-compile, RC=4 for SQL Warning, RC=8 for SQL Error Modified Source input to Compiler Compiler output: Object Object input to LKED LKED Output: Load Module DBRM input to Bind Bind output: Updated DB2 Catalog At execution time: Contokens from load and catalog are matched DB2 issues SQLCode -805 if mismatch 9
  10. 10. What’s a contoken anyway? • The DB2 consistency token (contoken) • 8 byte Hexidecimal string • Used by DB2 to ensure consistency at execution time 10 The contoken is created by the SQL pre-compiler and is placed in both the modified source and the DBRM. After a successful compile it can be found in both the load module and the DB2 catalog. At execution time DB2 searches SYSIBM.SYSPACKAGES for a version of the plan/package which contains a contoken that matches the contoken found in the load module. If a match is found, execution continues normally. If not, DB2 returns a -805 SQLCODE and will not execute the program. 10
  11. 11. Contoken in the Modified Source 01 SQL-PLIST2. 05 SQL-PLIST-CON PIC S9(9) COMP-4 VALUE +4210688. 05 SQL-CALLTYPE PIC S9(4) COMP-4 VALUE +50. 05 SQL-PROG-NAME PIC X(8) VALUE X'424D414E30312020'. 05 SQL-TIMESTAMP-1 PIC S9(9) COMP-4 VALUE +406568622. 05 SQL-TIMESTAMP-2 PIC S9(9) COMP-4 VALUE +102321767. Dec 406568622 = X’183BBEAE’ Dec 102321767 = X’06194E67’ 11 This slide shows where to find the contoken in the modified source. The block of code shown above isn’t coded by the application developer. It’s generated by the pre-compiler and inserted into the source which is passed on to the compiler. The values in SQL-TIMESTAMP-1 and SQL-TIMESTAMP-2 are joined together as a 8 byte HEX string. That string is the contoken. 11
  12. 12. Contoken in the DBRM 0 1 1 2 2 3 ----5----0----5----0----5----0---- DBRM µUSER PROGNAME ´Þ +Å CCDD000ACDCC4444CDCDFF4413BA0146 4294000041170000241501008BEE69E7 12 This slide shows the same contoken in the DBRM. The first record of a DBRM is the header record. The contoken is located in byte 25 of the DBRM header record. Notice this is the same Hex string from the previous slide. 12
  13. 13. How Compiling differs with Bind Manager • Old pre-compiler program (DSNHCP) replaced with new program (BNDAVB) • DBRM is both input and output • Additional steps in the “Compile” job • New Return Code checking requirements 13 Compiling with Bind Manager adds additional complexity to the process. Program BNDAVB must be implemented in place of the old DSNHCP. (pre- compiler) BNDAVB must have access to the old DBRM in order to make it’s comparison, so the DBRM becomes both an input and an output. Copying the DBRM to a temporary library for this step is recommended. This will make things much simpler if something goes wrong downstream in the compile process. It could be confusing to have the DBRM updated in the pre-compile and then have a syntax error in the compile step. You’d be left with a DBRM that is out of sync with your executable module. BNDAVB return codes 0 Successful pre-compile, no Bind required. 4 Successful pre-compile, Bind required 8 Unsuccessful pre-compile – no DBRM generated 13
  14. 14. The new program preparation process DBRM Copy Source Pre-Compile Modified Source Compile DBRMLIB Temp DBRM Object Link-Edit Load Pre RC = 0 YES? - STOP Bind DB2 Catalog DBRM Copy 14 Program Preparation with Bind Manager: Two inputs to pre-compiler: Source Statements & DBRM Two pre-compile outputs: DBRM and Modified Source RC=0 for no SQL changed (contoken from old DBRM added to modified source & New DBRM) RC=4 for SQL Changes (new contoken generated and added to modified source) RC=8 for SQL Error Modified Source input to Compiler Compiler output: Object Object input to LKED LKED Output: Load Module IF RC from BNDAVB step > 0 DBRM input to Bind Bind output: DB2 Catalog IF RC from BNDAVB step = 0 No Bind needed, catalog contoken matches load module Execution Time: Contokens from load and catalog are matched DB2 issues SQLCode -805 if mismatch 14
  15. 15. Implementing Bind Avoidance: The New program preparation process Sample JCL • //PRECOPY EXEC PGM=IEBGENER • //SYSUT1 DD DISP=SHR,DSN=permanent.dbrmlib(dbrmname) • //SYSUT2 DD DISP=SHR,DSN=temporary.dbrmlib(dbrmname) • //SYSPRINT DD SYSOUT=* • //SYSIN DD DUMMY • //*-------------------------------------------------- • //PC EXEC PGM=BNDAVB,PARM=’HOST(COB2),APOST’ • //STEPLIB DD DISP=SHR,DSN=db2.loadlib • //SYSLIB DD DISP=SHR,DSN=bndavb.loadlib • //SYSIN DD DSN=installation.sourcelib(member),DISP=SHR • //DBRMLIB DD DISP=SHR,DSN=temporary.dbrmlib(dbrmname) • //SYSCIN DD DISP=(,PASS),DSN=&&SYSCIN,UNIT=SYSALLDA, • // SPACE=(CYL,(5,5)) • //SYSUT1 DD SPACE=(CYL,(5,5)),UNIT=SYSDA • //SYSUT2 DD SPACE=(CYL,(5,5)),UNIT=SYSDA • //SYSPRINT DD SYSOUT=* • //SYSTERM DD SYSOUT=* • //SYSUDUMP DD SYSOUT=* • //*---------------------------------------------------- 15 Step PRECOPY: Copy the DBRM from our permanent DBRMLIB to our temporary DBRMLIB IEBGENER seems to be the most economical means PC: BNDAVB to pre-compile your source code and compare it to the existing DBRM The SYSCIN dataset can be scanned for messages if simple return code processing does not meet your needs. 15
  16. 16. Implementing Bind Avoidance: The New program preparation process Sample JCL (contd.) • //COB2 EXEC PGM=IGYCRCTL,COND=(4,GT),PARM=’OBJECT,MAP,APOST’ • //STEPLIB DD DISP=SHR,DSN=cobol2.loadlib • //SYSPRINT DD SYSOUT=* • //SYSIN DD DISP=(OLD,DELETE),DSN=&&SYSCIN • //SYSLIN DD DISP=(MOD,PASS),UNIT=SYSDA,DSN=&&LOADSET, • // SPACE=(TRK,(5,5)) • //SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(5,5)) • //SYSUT2 DD UNIT=SYSDA,SPACE=(CYL,(5,5)) • //SYSUT3 DD UNIT=SYSDA,SPACE=(CYL,(5,5)) • //SYSUT4 DD UNIT=SYSDA,SPACE=(CYL,(5,5)) • //SYSUT5 DD UNIT=SYSDA,SPACE=(CYL,(5,5)) • //SYSUT6 DD UNIT=SYSDA,SPACE=(CYL,(5,5)) • //SYSUT7 DD UNIT=SYSDA,SPACE=(CYL,(5,5)) • //*----------------------------------------------------- • //LKED EXEC PGM=IEWBLINK,PARM=’LIST,XREF,LET,MAP’,COND=(4,GT,COB2) • //SYSLIN DD DISP=(OLD,DELETE),DSN=&&LOADSET • //SYSLMOD DD DISP=SHR,DSN=loadlib(pgmname) • //SYSLIB DD DISP=SHR,DSN=syslib • //SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1)) • //SYSPRINT DD SYSOUT=* • //*------------------------------------------------------ 16 COB2: The compiler of your choice here. (this example is COBOL 2) LKED: The linkage editor can be used as it was before Bind Manager does not require any additional code at run time. 16
  17. 17. Implementing Bind Avoidance: The New program preparation process Sample JCL (contd.) • //BINDDBRM EXEC PGM=IKJEFT01,DYNAMNBR=30,COND=((4,GT,LKED),(4,NE,PC)) • //SYSTSPRT DD SYSOUT=* • //SYSPRINT DD SYSOUT=* • //SYSUDUMP DD SYSOUT=* • //DBRMLIB DD DISP=SHR,DSN=temporary.dbrmlib • //SYSTSIN DD * • DSN SYSTEM(dsn) • BIND control statements • END • /* • //*----------------------------------------------------- • //POSTCOPY EXEC PGM=IEBGENER,COND=((4,GT,BINDDBRM),(4,NE,PC)) • //SYSUT1 DD DISP=SHR,DSN=temporary.dbrmlib(dbrmname) • //SYSUT2 DD DISP=SHR,DSN=permanent.dbrmlib(dbrmname) • //SYSPRINT DD SYSOUT=* • //SYSIN DD DUMMY 17 BINDDBRM: Like the compile and Link, the Bind step requires nothing special. POSTCOPY: Copy your temporary DBRM into the permanent library. 17
  18. 18. What have we done? (Measuring the cost of Bind Manager) • Avg. CPU time for various steps: (seconds) • DSNHCP: 0.024 • BNDAVB No DBRM input 0.042 • BNDAVB with SQL changes 0.060 • BNDAVB with no SQL changes 0.058 • Package Bind 0.050 • DBRM Copy (IEBGENER) 0.010 • DBRM Copy (IDCAMS) 0.020 • BNDA024 0.372 18 The above timing statistics were gathered by running 50 of each job type and summing the recorded time statistics. Note: The numbers shown here for BNDA024 are not truly relevant to the current topic. They are shown here for comparison and will be explained later in the presentation. 18
  19. 19. Summing up the timings: Average CPU seconds for Bind related processing: • DSNHCP + Bind: 0.074 • 2 Copies + BNDAVB + Bind: 0.150 • 1 Copy + BNDAVB (Bind avoided) 0.078 19 Even when the Bind is avoided, the “old style” compile process uses less CPU. 19
  20. 20. Summing up the timings: • Additional CPU expense • Longer running compile jobs • What’s the point? 20 From the previous slide, it’s apparent that Bind avoidance isn’t without ongoing CPU cost. Now we need to see if 1) The savings from implementing Bind avoidance outweigh the associated costs?” 2) The benefits are seen to outweigh the additional cost 20
  21. 21. Additional reasons to avoid binds • Performance Driven Service Level Agreements • Multiple production environments 21 As an application service provider, DST’s environment is a little different than most. Our contracts with our client companies are performance driven. Failing to provide the contracted services results in immediate financial penalties. Predictable performance is a must. 21
  22. 22. DST DB2 Environment • Each client has its own production system including tables and programs • Around 40 production systems. 22 There are several product groups, each one with multiple “platforms”, TEST through STAGE through PROD. The PROD systems are replications of the same set of tables and programs. Our largest product group, Mutual Funds, has around 40 identical PROD platforms with over 3,000 tables and 17,000 programs in each platform. So, in addition to the other reasons we’ve already discussed to avoid a bind, DST has multiple (about 40) production instances of any given program. So when DST avoids a bind, we are really avoiding 40 binds. 22
  23. 23. Summing up the timings (again): Average CPU seconds for Bind related processing: • DSNHCP + 40 Binds: 2.024 • 2 Copies + BNDAVB + 40 Binds: 2.080 • 1 Copy + BNDAVB (Binds avoided) 0.078 23 Looking at this slide, we see a significantly different picture that the first set of numbers showed. Because the bind is performed so many times in our environment, the cost of Bind Avoidance can be recouped many times over. DST has chosen not to implement Bind Manager as part of the daily development cycle, where a single copy of the program may be compiled several times in the course of a day. Bind Manager is used only in the production migration pipeline. 23
  24. 24. DST Conclusions on Bind Avoidance • Bind Manager added some additional CPU cost in daily development work • Shops with multiple production instances may be able to actually reduce overall CPU usage when deploying the new program code • Avoiding the production outage or access path switch is the larger issue. 24 The cost (or savings) in CPU derived from Bind avoidance is not a compelling reason for most shops to consider Bind Manager. Production outages and access path switches can be very costly. Avoid the bind and minimize the risk. The more plans/packages you support, the more exposure you have to Bind related outages. 24
  25. 25. What have we done? (Part 2) (Measuring the effect of Bind Manager) • Building a Repository • Sample repository table • Sample SQL for mining the repository • Sample JCL for updating the repository • EBCDIC vs. UNICODE considerations • DST Conclusions 25 25
  26. 26. Sample Repository CREATE TABLE creator.BINDMGR_REPOSITORY ( DB2_SSID CHAR(4) NOT NULL, COLLID CHAR(8) NOT NULL, PROG_NAME CHAR(8) NOT NULL, COMPILE_COUNT DECIMAL(7) NOT NULL, BIND_COUNT DECIMAL(7) NOT NULL) 26 This is a VERY simple example. Your implementation will likely be more complex. 26
  27. 27. Sample JCL for updating repository • //LKED EXEC PGM=IEWL,PARM=’LIST,XREF,LET,MAP’,COND=(4,GT,COB2) • //SYSLIN DD DISP=(OLD,DELETE),DSN=&&LOADSET • // DD ddname=SYSIN • //SYSLMOD DD DISP=SHR,DSN=loadlib(pgmname) • //SYSLIB DD DISP=SHR,DSN=syslib • //SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1)) • //SYSPRINT DD SYSOUT=* • //*------------------------------------------------------ • //TBLUPDT1 EXEC PGM=????????,COND=(4,GT,LKED) • // PARM=‘pgmname,COMPILE’ • //SYSPRINT DD SYSOUT=* • //SYSUDUMP DD SYSOUT=* • //*------------------------------------------------------ • //BINDDBRM EXEC PGM=IKJEFT01,DYNAMNBR=30,COND=((4,GT,LKED),(4,GT,PC)) • //SYSTSPRT DD SYSOUT=* • //SYSPRINT DD SYSOUT=* • //SYSUDUMP DD SYSOUT=* • //DBRMLIB DD DISP=SHR,DSN=temporary.dbrmlib • //SYSTSIN DD * • DSN SYSTEM(dsn) • BIND control statements • END • /* • //*----------------------------------------------------- • //TBLUPDT2 EXEC PGM=????????,COND=(4,GT,BINDDBRM) • // PARM=‘pgmname,BIND’ • //SYSPRINT DD SYSOUT=* • //SYSUDUMP DD SYSOUT=* 27 In this sample JCL we execute our repository update program after the LKED and BIND steps. The parameters passed to the program tell it what update to perform. We are simply counting the program as “compiled” after we have successfully updated the load module. We count another bind after it is successfully bound. 27
  28. 28. Sample SQL for mining the repository SELECT PROG_NAME ,COMPILE_COUNT AS COMPILED ,BIND_COUNT AS BOUND ,COMPILE_COUNT – BIND_COUNT AS SKIPPED FROM BINDMGR_REPOSITORY WHERE DB2_SSID = your_ssid AND COLLID LIKE ‘collection%’ 28 This is a VERY simple example. Your implementation will likely be more complex. 28
  29. 29. EBCDIC vs Unicode • DB2 V8 NFM DBRM’s are in UNICODE! • Bind Manager makes no allowance for these CCSID differences! • An EBCDIC DBRM as input to a V8 NFM pre- compile will ALWAYS get an RC >=4 • Until the entire DBRM library is converted to UNICODE, bind avoidance is limited. 29 29
  30. 30. DST’s results (so far) • Number of DB2 programs changed: 411 • Number of Binds Executed: 380 • Number of Binds Avoided: 31 30 DST still has a large imbedded base of V7 DBRM’s. While we see a measurable effect we expect to see the numbers increase as time goes by. We expect Bind Manager to continue to help us shrink install windows and reduce unexpected results that occasionally occur when binding large numbers of packages. 30
  31. 31. Other Bind Manager Features • DBRM Cross Checker • Catalog Cross Checker • DBRM Browser • DBRM Generator • Static SQL load module report • Catalog Cleanup generator • Index Listing report 31 These are the other utilities that make up the Bind Manager Suite. Cross Checkers compare the Catalog or DBRM library to a load library (or set of load libraries). A browser that formats the DBRM header record and the individual SQL statements A utility to recreate a DBRM from the DB2 catalog A Utility to list all programs in a load library which use static SQL A Utility to create FREE commands for plans/packages with no corresponding load module A Utility to list all the indexes for a specific table 31
  32. 32. ISPF Bind Manager Utilities Bind Manager 2.3.0 COMMAND ===> Select the desired mode of operation 0 SETTINGS Defaults 1 PLAN Plan mode 2 PKG Package mode 3 BROWSE Browse DBRMs 4 GENERATE Rebuild DBRMs 5 IXU Index Utility X EXIT End dialog Options: / Translate DB2 time stamps 32 Here is the Bind Manager 2.3.0 Utility Main Menu Turning on the “Translate DB2 time stamps” option causes contokens to be converted to timestamp external format We’ll look at each option in detail. 32
  33. 33. ISPF Bind Manager Settings Panel Bind Manager - SETTINGS COMMAND ===> Scroll ===> PAGE Default high level qualifier for work files . . . . . . . . tsoid 33 The only option available is the default HLQ for the work datasets to be allocated during your session. The default installation value is your TSO ID. This is configurable by the Systems Programmer who installs the product. 33
  34. 34. Cross Checkers • Cross reference the DB2 Catalog, DBRM library and Load library • Report on differences and matches 34 These tools allow you to quickly see where matched sets of load modules, DBRMs and bound objects are located. 34
  35. 35. Cross Checker Plan Mode Panel ------------------------- DBRM Cross Check -------------------------- COMMAND ===> DBRM Data Set Name . . ‘your.dbrm.dataset' Member . . . . . member LOAD Data set name . . ‘your.load.library' MODULE Member . . . . . member DB2 Local . . . . . . ssid Subsys Remote . . . . . ssid 35 This panel requires fully qualified DSNs for the DBRM and Load module libraries. If you do not supply a member name, you can browse a list of members and select one Wildcards are not supported 35
  36. 36. Cross Checker Plan Mode Output ------------------------- DBRM Cross Check -------------------------- COMMAND ===> .------------ DBRM Verification Results ------------. | COMMAND ===> | | | | -- Source -- ------- Time Stamp ------- | | | | DBRM 17BA3AB3 0BF192E5 (hex) | | DB2 Catalog (No match) | | Load Module 17BA3AB3 0BF192E5 (hex) | | | | | | | '---------------------------------------------------' .-----------------------------------------------. | BND366E MEMBER not found in ssid, SQLCODE 100 | '-----------------------------------------------' 36 The output is ISPF popup panel that overlays the selection panel. In this example the plan was not found in the DB2 catalog and the Translate DB2 Time Stamps option was off 36
  37. 37. Cross Checker Package Mode Panel ------------------------ Package Cross Check ------------------------ COMMAND ===> Scroll ===> PAGE DBRM Data Set Name . . . . ‘your.dbrm.library' Member . . . . . . . . member PACKAGE Collection . . . . . . ----+----1----+--- 1 18 Version . . . . . . . ----+----1----+----2----+----3 1 30 LOAD Data set name . . . . ‘your.load.library' MODULE Member . . . . . . . . member DB2 Local . . . . . . . . ssid Subsys Remote . . . . . . . . ssid 37 This panel requires fully qualified DSNs for the DBRM and Load module libraries. If you do not supply a member name, you can browse a list of members and select one Wildcards are not supported In addition to the name and library the user can Collection and Version 37
  38. 38. Cross Checker Package Mode Output ----------------------------- Package Cross Check ----------------------------- .------------------------- DBRM Verification Results -------------------------. | Row 1 to 2 of 2 | | COMMAND ===> Scroll ===> PAGE | | | | DBRM time stamp . . . . . : 17BA3AB3 0BF192E5 (hex) | | Load module time stamp . . : 17BA3AB3 0BF192E5 (hex) | | | | ------------------- DB2 Subsystem (SYSIBM.SYSPACKAGE) -------------------- | | ------- Timestamp -------- --- Collection --- -------- Version --------- | | 1 18 1 26 | | ----+----1----+--- ----+----1----+----2----+- | | 179D4C94 035E80E8 (hex) collection1 | | 17BA3AB3 0BF192E5 (hex) collection2 | | ***************************** Bottom of data ****************************** | | | | | | | '-----------------------------------------------------------------------------' .---------------------------------------------------------------. | BND375I Warning: multiple instances of MEMBER found in ssid | '---------------------------------------------------------------' 38 The output screen for package mode is larger and contains more information The portion of the panel containing collection specific information is scrollable Note the message at the bottom indicating multiple instances 38
  39. 39. DBRM Browser • Shows a formatted display of the DBRM Contents 39 39
  40. 40. DBRM Browser Panel --------------------------- Browse DBRM ---------------------------- COMMAND ===> DBRM Data Set Name . . ‘your.dbrm.library' Member . . . . . member 40 This panel requires a fully qualified DSN If you do not supply a member name, you can browse a list of members and select one Wildcards are not supported 40
  41. 41. DBRM Browser Output Command ===> Scroll ===> CSR ********************************* Top of Data ********************************** ------------- DBRM Header ------------- Record ID (DBRMHID) DBRM Record Length (DBRMHLEN) 160 Precompile User ID (DBRMUSER) userid Program name (DBRMPROG) member Precompile timestamp (DBRMTIMS) 2005.10.26.19.14.32.299083 ( 17BA3AB30BF192E5 hex ) Options (DBRMPOPT) APOST,PERIOD,APOSTSQL,GRAPHIC(NO), LANG=COBOL II,TIME(LOCAL),DECIMAL(31),FOLD, FLOAT(IEEE),SQL(DB2) Character set ID (DBRMCCSID) 0000 (hex) Max section number (DBRMMAXS) 0 Entry stmt format (DBRMTYPE) 1 Reserved (DBRMSCC) 0000 (hex) Flags 80 (hex) Dependency marker (DBRMPDRM) N DB2 Version (DBRMMRIC) K (Version 7) 41 The output from the Browse DBRM function is contained in a temporary dataset. The user is automatically placed in Browse mode to see the output. The top of the dataset contains the DBRM header information. 41
  42. 42. DBRM Browser Output Section 3 Statement nbr 236 SQL statement: SELECT CURRENT TIMESTAMP INTO : H FROM SYSIBM . SYSDUMMY1 Host variables referenced by this statement: TYPE=Output VARIABLE=WS-WORK-FLDS.WS-CURR-TIMESTAMP Section 1 Statement nbr 274 SQL statement: OPEN TBL_CURSOR Host variables referenced by this statement: TYPE=Undefined VARIABLE=WS-WORK-FLDS.WS-P1-DEC TYPE=Undefined VARIABLE=WS-WORK-FLDS.WS-P2-DEC Section 4 Statement nbr 298 SQL statement: SELECT CURRENT TIMESTAMP , CURRENT TIMESTAMP - 15 SECONDS INTO : H , : H FROM SYSIBM . SYSDUMMY1 Host variables referenced by this statement: TYPE=Output VARIABLE=WS-WORK-FLDS.WS-CURR-TIMESTAMP TYPE=Output VARIABLE=WS-WORK-FLDS.WS-COMP-TIMESTAMP 42 Here are a few SQL statements as shown by the DBRM browser. Easier to read than the DBRM 42
  43. 43. DBRM Rebuilder • Creates a usable DBRM from the DB2 catalog 43 This utility could be very useful in shops where there is a large base of legacy code. You could actually bind a program even if both the Source and DBRM were lost. 43
  44. 44. DBRM Rebuilder Menu -------------------------------------------------------------- DBRM Rebuilder COMMAND ===> Select one of the following options: 1 PLAN Plan mode 2 PKG Package mode X EXIT End dialog Subsystem ID . . . . . . ssid 44 Here’s the sub-menu for the DBRM rebuilder 44
  45. 45. DBRM Rebuilder – Package mode DBRM Rebuilder Command ===> Specify collection and package names Collection . . . . . . . collid ----+----1----+--- 1 18 Package (DBRM) . . . . . member ----+--- 1 8 Specify the output DBRM library DBRM library . . . . . ‘your.dbrmlib' 45 This panel requires a fully qualified DSN for the DBRM library. The collection and package must be supplied completely. Wildcards or search feature are not supported 45
  46. 46. DBRM Rebuilder – Package mode Collection . . . . : collid Package . . . . . : member Select the desired version 1 64 ----+----1----+----2----+----3----+----4----+--- . 2005-10-07-19.44.06.405120 . 2005-10-21-19.31.54.724012 . 2007-04-12-15.02.15.350200 . 2007-04-16-19.20.45.773532 . 2007-05-07-19.10.02.623747 . 2007-05-12-12.48.38.155840 . 2007-05-19-19.26.29.013473 . 2007-06-09-13.09.23.673500 ' 46 If multiple version are found, this panel will be displayed Select a version and press enter to continue 46
  47. 47. DBRM Rebuilder – Package mode .-------------------------------------------------. | Confirm Update | | COMMAND ===> | | | | The DBRM library already contains a member | | named MEMBER. | | | | If you continue, the existing member will be | | replaced (overwritten) by the new (rebuilt) | | DBRM. | | | | Press ENTER to continue (replace the existing | | member). | | | | Press END to cancel the operation (do not | | overwrite the member). | '-------------------------------------------------' 47 This warning message is issued if you attempt to rebuild a DBRM that already exists. 47
  48. 48. DBRM Rebuilder – Package mode DBRM Rebuilder DBRM CREATED Command ===> Specify collection and package names Collection . . . . . . . collid ----+----1----+--- 1 18 Package (DBRM) . . . . . member ----+--- 1 8 Specify the output DBRM library DBRM library . . . . . ‘your.dbrmlib' 48 After successful creation you wind up back at the start screen with the DBRM CREATED message in the upper right corner. 48
  49. 49. DBRM Rebuilder – Package mode DBRM µ$REBUILTmember ¼ p 2 2005-10-07-19.44.06.405120 DBRM K bDECLARE D73_CURSOR CURSOR FOR SELECT D73 . TO_DB ON FROM D73_A999 AS D73 WHERE D73 . FROM_DB2_LOCATION = : H FOR READ ONL D MFS-D73-A999.FROM-DB2-LOCATION DBRM ´ ¸ ÑINSERT INTO HT6_A999 ( OPERATOR_ID , LAST_MNT_DA , LAST_MNT_OPID , ORN_CHG_DB2_LOC , ORN_LOC_CHG_DT_TM , OPR_PSW_TX , OPR _DT , OPR_LAS_LOGON_DT , OPR_LOGON_ATP_CT , OPR_DISABLED_CD , OPR_MUL_LO , OPR_NM , OPR_PSW_CHG_ALW_CD , PSW_EXPR_DAY_CT , OPR_EXPT_STR_DT , OPR_ RS_DT , OPR_ENCR_PSW_1_TX , OPR_ENCR_PSW_2_TX , OPR_ENCR_PSW_3_TX , OPR_ _4_TX , OPR_ENCR_PSW_5_TX , OPR_ENCR_PSW_6_TX , PEOPLESOFT_ID ) VALUES ( URRENT TIMESTAMP , : H , : H , : H , : H , : H , : H : H , : H , : H , : , : H , : H : H , : H , : H : H , : H , : H , : H , : H , : H , : H , : D MFS-HT6-A999.OPERATOR-ID D -A999.LAST-MNT-OPID D MFS-HT6-A999.ORN-CHG-DB2-LOC D MFS-HT6-A999.ORN-LOC-CHG-DT-TM D MFS-HT6-A 49 Here’s a look at the DBRM. Notice the text $REBUILT on the header record? 49
  50. 50. Index Utility • Creates a list of indexes for a specific table 50 This feature is included in most vendor DBA toolsets. I’m not sure how it fits with the rest of the Bind Manager toolset. 50
  51. 51. Index Utility Panel Bind Manager Index Utility COMMAND ===> Specify the table whose indexes are to be displayed: Subsystem ID ssid Table name creator.table ----+----1----+----2----+-- 51 Just specify the DB2 subsystem and qualified table name Remote tables (3 part name) are not supported Wildcards in the table name are not supported 51
  52. 52. Index Utility Output .---------------------------- Available Indexes -----------------------------. | Row 1 to 1 of 1 | | COMMAND ===> Scroll ===> PAGE | | | | | | | | ------- Index Name -------- ---------- Index Key Columns ----------- | | . Creator.index DB2_SYSTEM (A), IXCREATOR (A), IXNAME (+ | | ***************************** Bottom of data ***************************** | | | | | | | | | | | | | | | | | | | | | '----------------------------------------------------------------------------' 52 The output is a scrollable ISPF panel showing all indexes for the table entered 52
  53. 53. Batch Bind Manager Utilities • Static SQL load module report • Catalog Cleanup utility • DBRM Generator utility • Timestamp list utility 53 Most of the same capabilities (and a few new ones) are available as batch jobs. 53
  54. 54. Static SQL load module report • Runs Batch only • Specify • Load Library • Report shows • List of all modules and if they contain static SQL 54 This is a handy way see which programs use static SQL (and which do not). There are other ways to do this, but not one as easy. 54
  55. 55. Static SQL load module report : JCL //* //* CREATE A REPORT OF LOAD MODULES CONTAINING STATIC SQL: //* //BNDA007 EXEC PGM=BNDA007 //STEPLIB DD DSN=bind.manager.loadlib,DISP=SHR //SYSUDUMP DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSOUT DD SYSOUT=* //SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(10,10)) //LOADLIB DD DSN=your.installation.loadlib,DISP=SHR // 55 STEPLIB: the library where the Bind Manager routines reside LOADLIB: the load library you wish to report on SYSPRINT: the report dataset 55
  56. 56. Static SQL load module report : Output Load Library: large.production.loadlib --LMOD-- CSECT SQL? AA0001 AA0001 Yes AA0002 AA0002 Yes AA0003 AA0003 Yes AA0004 AA0004 Yes B01150 No B01540 B01540 Yes B01540X B01540 Yes B01541 B01541 Yes B02232 No B02233 DB2NTRY Yes B02234 B02234 Yes B02235 No B02235A No B02236 B02236 Yes B02238 B02238 Yes B02239 B02239 Yes 56 The report shows ALL modules in the specified load library The SQL? Column indicates if SQL is present in the program 56
  57. 57. Catalog Cleanup utility • Runs Batch only • Specify • DB2 SSID • Load Library(s) • Member name(s) (wildcards OK) • Output • FREE plan/package statements generated for plans/packages with no matching load module 57 57
  58. 58. Catalog Cleanup utility : JCL //BNDA020 EXEC PGM=BNDA020 //STEPLIB DD DSN=bind.manager.loadlib,DISP=SHR // DD DSN=db2.loadlib,DISP=SHR //SYSUDUMP DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSOUT DD SYSOUT=* //*BRMOUT DD SYSOUT=* //BNDFCMD DD SYSOUT=* //SYS001 DD DSN=application.loadlib,DISP=SHR //BNDIN DD * DSN(ssid) /* 58 STEPLIB: the library where the Bind Manager routines reside SYS###: the load library (libraries) you wish to search SYSPRINT: the report dataset BNDFCMD: generated FREE package/plan commands 58
  59. 59. Catalog Cleanup Utility : SYSPRINT BND601I Begin Program at Wed Feb 27 14:51:39 2008 PK41941 BND623I BNDIN found BND605I Connect to SSID DBA0 requested BND637I This is a V8 (or later) system BND603I 25166 SYSIBM.SYSPACKAGE entries BND604I 24606 working package data entries BND636I BNDA021 return = 0 BND602I End Program at Wed Feb 27 17:11:51 2008 59 59
  60. 60. Catalog Cleanup Utility : SYSPRINT BND601I Begin Program at Mon Feb 11 09:06:46 2008 PK41941 BND623I BNDIN found BND690I The follow are the SQLCA Fields: DSNT408I SQLCODE = -991, ERROR: CALL ATTACH WAS UNABLE TO ESTABLISH AN IMPLICIT CONNECT OR OPEN TO DB2. RC1=000C RC2=00F30006 DSNT418I SQLSTATE = 57015 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNACA00 SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = 0 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'00000000' X'00000000' X'00000000' X'FFFFFFFF’ 60 An error in the format of the SSID parameter (omitting the parenthesis) produced this message. 60
  61. 61. Catalog Cleanup Utility : BNDFCMD ** FREE PACKAGE (ACS911_D_MAIN.ACSBQLU.(ACS_0911)) ** FREE PACKAGE (ACS911_D_MAIN.ACSBQOS.(ACS_0911)) ** FREE PACKAGE (ACS911_D_MAIN.ACSBQPA.(ACS_0911)) ** FREE PACKAGE (ACS911_D_MAIN.ACSBQPD.(ACS_0911)) ** FREE PACKAGE (ACS911_D_MAIN.ACSBQPG.(ACS_0911)) ** FREE PACKAGE (ACS911_D_MAIN.ACSBQPI.(ACS_0911)) ** FREE PACKAGE (ACS911_D_MAIN.ACSBQPL.(ACS_0911)) ** FREE PACKAGE (ACS911_D_MAIN.ACSBQPP.(ACS_0911)) ** FREE PACKAGE (ACS911_D_MAIN.ACSBQPS.(ACS_0911)) ** FREE PACKAGE (ACS911_D_MAIN.ACSBQPX.(ACS_0911)) 61 This is just a sample of some of the FREE commands that were generated 61
  62. 62. DBRM Generator • Runs Batch or Online • Rebuilds a usable DBRM from the DB2 catalog • Bytes 10-17 of DBRM header contain “$REBUILT” 62 This utility is also available from the ISPF menu. 62
  63. 63. DBRM Generator – JCL //BINDMGR EXEC PGM=BNDA024 //STEPLIB DD DSN=bind.manager.loadlib,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSOUT DD SYSOUT=* //SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(10,10)) //DBRMLIB DD DSN=installation.dbrmlib(member),DISP=SHR //SYSIN DD * SSID ssid PACKAGE collection.name.(version) /* 63 63
  64. 64. DBRM Generator – Output DBRM µ$REBUILTmember ¼ p 2 2005-10-07-19.44.06.405120 DBRM K bDECLARE D73_CURSOR CURSOR FOR SELECT D73 . TO_DB ON FROM D73_A999 AS D73 WHERE D73 . FROM_DB2_LOCATION = : H FOR READ ONL D MFS-D73-A999.FROM-DB2-LOCATION DBRM ´ ¸ ÑINSERT INTO HT6_A999 ( OPERATOR_ID , LAST_MNT_DA , LAST_MNT_OPID , ORN_CHG_DB2_LOC , ORN_LOC_CHG_DT_TM , OPR_PSW_TX , OPR _DT , OPR_LAS_LOGON_DT , OPR_LOGON_ATP_CT , OPR_DISABLED_CD , OPR_MUL_LO , OPR_NM , OPR_PSW_CHG_ALW_CD , PSW_EXPR_DAY_CT , OPR_EXPT_STR_DT , OPR_ RS_DT , OPR_ENCR_PSW_1_TX , OPR_ENCR_PSW_2_TX , OPR_ENCR_PSW_3_TX , OPR_ _4_TX , OPR_ENCR_PSW_5_TX , OPR_ENCR_PSW_6_TX , PEOPLESOFT_ID ) VALUES ( URRENT TIMESTAMP , : H , : H , : H , : H , : H , : H : H , : H , : H , : , : H , : H : H , : H , : H : H , : H , : H , : H , : H , : H , : H , : D MFS-HT6-A999.OPERATOR-ID D -A999.LAST-MNT-OPID D MFS-HT6-A999.ORN-CHG-DB2-LOC D MFS-HT6-A999.ORN-LOC-CHG-DT-TM D MFS-HT6-A 64 Here’s a look at the DBRM. Notice the text $REBUILT on the header record? 64
  65. 65. DBRM/Catalog Cross Checker • Runs Batch Only • Specify • DB2 SSID • DBRM member name (wildcards OK) • Report shows • All matching occurrences of the specified DBRM in the DB2 catalog • Contoken values are expressed in external Timestamp format 65 65
  66. 66. DBRM Cross Checker – JCL //BNDA030 EXEC PGM=BNDA030 //STEPLIB DD DSN=bind.manager.loadlib,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSOUT DD SYSOUT=* //DBRMLIB DD DSN=installation.dbrmlib,DISP=SHR //SYSIN DD * SSID ssid DBRM member /* 66 66
  67. 67. DBRM Cross Checker – Output Target DBRM . . . . . . member Target Timestamp . . . 2006.04.19.12.18.38.372010 Target Version . . . . --------------------------------------------------------- Location: Collection: collid1 Version: Timestamp: 2008.01.28.14.33.09.723109 --------------------------------------------------------- Location: Collection: collid2 Version: Timestamp: 2005.04.21.15.59.15.318892 --------------------------------------------------------- Location: Collection: collid3 Version: Timestamp: 2006.04.19.12.18.38.372010 *** MATCH *** 67 Here’s a look at the DBRM. Notice the word REBUILT on the header record? 67
  68. 68. Conclusions on the tools • A useful set of tools for automating some repetitive processes. • Some inconsistencies in syntax with existing DB2 products • An “interesting” error generated by faulty syntax 68 68
  69. 69. More Info. • Product Overview: • http://www-306.ibm.com/software/data/db2imstools/db2tools/db2bindmngr.html • IBM Publications Library for Bind Manager: • http://www-306.ibm.com/software/data/db2imstools/db2tools-library.html#bindmgr-lib 69 69
  70. 70. Known Bugs & fixes • APAR PK56186 • PTF UK31795 • Desc: Program BNDA024 produces incorrect statement numbers for new DBRMs 70 Under V8 NFM the statement number column is increased in size. The rebuilt DBRM contains a space X’40’ embedded in the statement number. (causes statement numbers to appear well out of “normal” range. 70
  71. 71. Questions? 71 71
  72. 72. Session ##### To Bind Or Not To Bind – Let Bind Manager Decide Joe Goodman DST Systems Inc. jagoodman@dstsystems.com 72 72

×