Generic Attach on Z/OS (or attachment demystified)

Similar documents
Session: E05 DB2 Attachment Facilities. John Maenpaa Health Care Service Corporation. October 7, :00 a.m. 12:00 p.m. Platform: DB2 for z/os

Mainframe Developer NO.2/29, South Dhandapani St, Burkit road, T.nagar, Chennai-17. Telephone: Website:

Progressive s DB2 Tools and Utilities

Develop a batch DB2 for z/os COBOL application using Rational Developer for System z

Introduction. JES Basics

Getting Started with Xpediter/Eclipse

DB2 for z/os Stored Procedures Update

SPICE. SPICE DL/I Product Description. Release 1.1 SPI Span Software Consultants Limited

Efficiently Accessing WebSphere MQ Messages from an IMS Application Using the MQ API)

Chapter 1 CONCEPTS AND FACILITIES. SYS-ED/ Computer Education Techniques, Inc.

IMS DB/DC for Technical Support

Mainframe Developer & Admin Training in Chennai

SmartIS. What is SmartIS? Product Description

IBM DEBUG TOOL NEWSLETTER

Planning Guide and Reference

COMP 3400 Mainframe Administration 1

Chapter 1. Overview Topic: What's new Topic: Features and benefits

JCL JOB CONTROL LANGUAGE

IBM Application Performance Analyzer for z/os Version IBM Corporation

A System z Developer's Journey Through the Application Lifecycle

IMS DATABASE FOR MAINFRAME

IBM InfoSphere Classic Federation Server for z/os Version 11 Release 3. System Messages

The Modern Mainframe. IBM Systems. Powerful, secure, dependable and easier to use. Bernice Casey System z User Experience

Service Information. English Component

Db2 Query Management Facility Version 12 Release 2. Installing and Managing Db2 QMF for TSO and CICS IBM GC

Legac-E Education. Passing Parameters. to COBOL sub-routines

BMC Subsystem Optimizer for zenterprise Reducing Monthly License Charges

IBM MQ for z/os Version : Migration and Queue Sharing Group Co-existence

IMS V12 DB and DBRC Enhancements Session Number #10801

How to Setup MTO/JCL Spooler Housekeeping Facility for Enterprise Server

IBM Rational COBOL Runtime Guide for zseries

WebSphere Java Batch WP at ibm.com/support/techdocs Version Date: September 11, 2012

z/os Db2 Batch Design for High Performance

Using dynamic SQL in COBOL

* Parameter... 1:18. B Backward References... 5:8 Blocksize: Choosing... 3:19

Configuring IBM s WebSphere Application Server

SPICE. SPICE DL/I Product Reference Manual. Release 3.1 SPI Span Software Consultants Limited

IBM Data Virtualization Manager for z/os Version 1 Release 1. Installation and Customization Guide IBM GC

See the mechanics of how to do this for a cycle-driven process with a high degree of usability and easy job output management.

Full Speed Ahead with COBOL Into the Future

Topaz for Total Test User Guide

JCL MOCK TEST JCL MOCK TEST IV

Uni Hamburg Mainframe Summit 2010 z/os The Mainframe Operating. Part 5 Application Support

IBM Program Restart Facility for IMS Facilitates Automated Restarts

IFCID Instrumentation Accounting Data This topic shows detailed information about Record Trace - IFCID Instrumentation Accounting Data.

IMS Evolution. IMS database

IBM Software Group. Code Coverage

MQSeries for OS/390 - Log extract program

APPLICATIONS MANAGEMENT ASG-SMARTTEST FOR INTERACTIVE APPLICATION TESTING AND DEBUGGING

WebSphere Java Batch. WP at ibm.com/support/techdocs Version Date: September 11, 2012

Introduction to the SAS/ACCESS Interface to IMS

Failures under MVS p. 67 General p. 67 JCL Errors p. 68 Syntactical JCL Errors p. 68 Allocation JCL Errors p. 69 ABEND Failures p.

APIs Economy for Mainframe Customers: A new approach for modernizing and reusing mainframe assets

What s New in Studio and Server Enterprise Edition 6.0?

Mainframe Tutorials Cobol Db2 Jcl Cics Tutorials

Application Design and Programming with HALDB

Debug DB2 COBOL stored procedure with IBM Developer for z Systems and IBM Debug for z Systems v14.1

IBM DB2 11 DBA for z/os Certification Review Guide Exam 312

IMS V13 Overview. Deepak Kohli IMS Product Management

Micro Focus Studio Enterprise Edition Test Server

Item A The first line contains basic information about the dump including its code, transaction identifier and dump identifier. The Symptom string

#3) Problem : IMS - DFS870A - while trying to take the image copy of IMS database

Can IBM Debug Tool and RDz Integrated Debugger both coexist in same CICS region?

CA InterTest Batch CA RS 1404 Service List

IBM Data Virtualization Manager for z/os Version 1 Release 1. Installation and Customization Guide IBM GC

TestBase's Patented Slice Feature is an Answer to Db2 Testing Challenges

z/os Introduction and Workshop Unix System Services 2009 IBM Corporation 2017 IBM Corporation

CA Endevor Software Change Manager CA RS 1606 Service List

The Master Console Center (MCC) automates and enhances data center operations by:

ATFEXTR command: extract OMEGAMON V5.3 ATF Enhanced Summary records from IMS log

IBM Transaction Analysis Workbench for z/os. Lab

IBM PDTools for z/os. Update. Hans Emrich. Senior Client IT Professional PD Tools + Rational on System z Technical Sales and Solutions IBM Systems

COBOL performance: Myths and Realities

Lesson 11 Transcript: Concurrency and locking

CA JCLCheck Workload Automation CA RS 1411 Service List

Updates that apply to IBM DB2 Analytics Accelerator Loader for z/os V2R1 User's Guide (SC )

SPICE. SPICE SQL General Information Manual. Release 1.1 SPI Span Software Consultants Limited

IMS/DBCTL Migration and Performance Considerations

Adapter for Mainframe

VSHARE FOR Z/OS. Installation and Operations Guide. VSHARE allows multiple programs to access and. simultaneously by giving batch jobs the ability to

Introduction. Chapter 1:

CA JCLCheck Workload Automation CA RS 1404 Service List

Introduction to DB2 11 for z/os

Migrating to Tivoli Decision Support for z/os (TDSz) Version 1.8.2

EView/390z Mainframe Discovery for ServiceNow Discovery for CMDB

Craig S. Mullins. A DB2 for z/os Performance Roadmap By Craig S. Mullins. Database Performance Management Return to Home Page.

What's New In the IBM Problem Determination Tools

Understanding The Interaction Of z/os Workload Manager And DB2

IMS Performance - Getting The Most Out Of Your Monitoring Technology: Isolating And Solving Common Issues

Expert Stored Procedure Monitoring, Analysis and Tuning on System z

IBM Fault Analyzer for z/os

Introduction. Chapter 1: Objectives

Implementing Data Masking and Data Subset with IMS Unload File Sources

CA IDMS CA RS 1611 Service List

BEARS IMS. Messages and Codes Manual VIO Systems Limited. 1988, 2004 VIO Systems Limited. All rights reserved

CA Workload Automation ESP Edition CA RS 1312 Service List

Open Data Analytics for z/os Version 1 Release 1. Solutions Guide IBM SC

QCOPYPRP Sample COBOL WMQ CICS Copy messages adding Message Properties QCOPYPRP. Sample COBOL CICS WMQ Program Copy messages and apply a property

COMP 3400 Mainframe Administration 1

IBM. z/os Batch Runtime: Planning and User's Guide. z/os. Version 2 Release 3 SA

Transcription:

Generic Attach on Z/OS (or attachment demystified) Jack Bailey BlueCross BlueShield of South Carolina Jack.bailey@bcbssc.com Session Code: A13 Date and Time of Presentation: May 14, 2010 08:30 AM 09:30 AM Platform: Z/OS 1

Objectives What is DB2 attachment? What are various attachment methods and how are they used? What is different in today's applications? What is generic attach? What is the importance of two-phased or co-ordinated commits? When you should NOT free yourself from imbedded attachment? 2

Food for Thought DB2 Version 8 Application Programming and SQL Guide Chapter 23. Processing DL/I batch applications Page 568 Requirements for using DB2 in a DL/I batch job Using DB2 in a DL/I batch job requires the following changes to the application program. You must add SQL statements to your application program to gain access to DB2 data. 3

Translation Requirements for using DB2. You must add SQL statements to your application program to gain access to DB2 data. 4

Translation Application Program DB2 5

What is DB2 Attachment? Attachment is simply the creation and maintenance of the communication path between an application and a database management system while the application is active.. 6

DB2 Attachment Application Program DB2 DB2 Attachment 7

SQL Query SELECT CLIENT_NAME FROM CLIENT_TABLE WHERE CLIENT_NO =? AND SYS_VOID_STS_IND = 'N' 8

Application program EXEC SQL SELECT CLIENT_NAME INTO :CLI-REC.CLIENT-NAME FROM CLIENT_TABLE WHERE CLIENT_NO = :WS-CLIENT-NO AND SYS_VOID_STS_IND = 'N' END-EXEC 9

Compile process Cobol Source Code DB2 Precompiler Cobol Compiler Object Code 10

Application program EXEC SQL SELECT CLIENT_NAME INTO :CLI-REC.CLIENT-NAME FROM CLIENT_TABLE WHERE CLIENT_NO = :WS-CLIENT-NO AND SYS_VOID_STS_IND = 'N' END-EXEC Not valid Cobol Source Code Input to the DB2 precompiler 11

Cobol Source code *****EXEC SQL ***** SELECT CLIENT_NAME ***** INTO :CLI-REC.CLIENT-NAME ***** FROM CLIENT_TABLE ***** WHERE CLIENT_NO = :WS-CLIENT-NO ***** AND SYS_VOID_STS_IND = 'N' *****END-EXEC PERFORM SQL-INITIAL UNTIL SQL-INIT-DONE CALL XXXXXX' USING SQL-PLIST13 Valid Cobol Source Code Input to the Cobol compiler Two functions: 1) Establish addressability to host variables (unless already done. UNTIL SQL-INIT-DONE) 2)Call the Attachment module. 12

Cobol Source code PERFORM SQL-INITIAL UNTIL SQL-INIT-DONE CALL XXXXXX' USING SQL-PLIST13 1. Perform Host Variable Addressability 2. Call the DB2 attachment program for specific SQL statement Two functions: 1) Establish addressability to host variables (unless already done. UNTIL SQL-INIT-DONE) 2)Call the Attachment module. 13

Host Variable Addressability Why should you avoid using Linkage Section host variables? Why should you avoid using Linkage section host variables? 14

Host Variable Addressability 77 SQL-INIT-FLAG PIC S9(4) COMP-4 VALUE +0. 88 SQL-INIT-DONE VALUE +1. PROCEDURE DIVISION. DSNSQL SECTION. SQL-SKIP. GO TO SQL-INIT-END. SQL-INITIAL. MOVE 1 TO SQL-INIT-FLAG. CALL 'DSNHADDR' USING SQL-VPARMPTR OF SQL-INIT-END. CONTINUE PERFORM SQL-INITIAL UNTIL SQL-INIT-DONE Why should you avoid using Linkage section host variables? 15

Call the DB2 Attachment Program for a specific SQL statement CALL XXXXXX' USING SQL-PLIST13 XXXXXX is the name of the DB2 Attachment program. The default format of the Call statement is static. Why should you avoid using Linkage section host variables? 16

Cobol Source code Host Variable Addressability PROCEDURE DIVISION. DSNSQL SECTION. SQL-SKIP. GO TO SQL-INIT-END. SQL-INITIAL. MOVE 1 TO SQL-INIT-FLAG. CALL 'DSNHADDR' USING SQL-VPARMPTR OF SQL-INIT-END. CONTINUE PERFORM SQL-INITIAL UNTIL SQL-INIT-DONE Why should you avoid using Linkage section host variables? 17

DB2 Attachment methods TSO Attach DSNELI CALL Attach (CAF) DSNALI (3rd Party Softbase s Database Attach) IMS Attach DFSLI000 (IMS language interface module) CICS Attach DSNCLI Recoverable Resource Services Attach (RRSAF) DSNRLI 18

TSO Attach - DSNELI Traditional Vanilla DB2 out of the box Batch Job executes IKJEFT01 (TSO Monitor program) to invoke commands Commands are passed to the TSO Monitor program through a SYSTSIN DD DSN SYSTEM(DB2O) - DB2O being DB2 subsystem RUN PROGRAM(ApplPgm) PLAN(ApplPlan) END Commands are serially processed. DSN Command causes the attachment to DB2 RUN Command transfers control to an application program Application program must use DSNELI as the Attachment for communication with DB2 END completes the step and terminates Connection to DB2 The TSO monitor program intercepts all exceptions and reports them as condition codes unless alternate programs IKJEFT1A or IJKEFT1B are used. 19

CALL Attach (CAF) DSNALI Coding your own connects Typically third party product is used to reduce coding ie. Softbase s Database Attach Batch Job executes Application program No IKJEFT01 (TSO Monitor program) overhead Execution is not limited to DB2 availability Typically commands (exp 3 rd party) passed to through a SYSTSIN DD DSN SYSTEM(DB2O) - DB2O being DB2 subsystem RUN PROGRAM(ApplPgm) PLAN(ApplPlan) END Commands are serially processed. DSN Command causes the attachment to DB2 WHEN first SQL/CONNECT is encountered RUN Command supplies the DB2 Plan for Attachment / Program is ignored Application program must use DSNALI (or 3 rd party name) as the Attachment for communication with DB2 END has no meaning 20

IMS Attach DFSLI000 DFSLI000 is the IMS language Interface module. DFSLI000 is the IMS Stub for all application interfaces not just DB2. IMS Checkpoint / Restart facility Coordinated commits Coordinated recovery Same coding as any IMS/DB program (IMS does all of the work) TWO ways to invoke DFSLI000 from BATCH. 21

IMS Attach DFSLI000 DL/I Batch Job executes DFSRRC00 but passes DSNMTV01 (DB2 Interface program) as program to invoke. All application programs attempting to access DB2 must be statically linked. Execution is limited to DB2 availability Typically commands passed to through a DDITV02 DD DB2O,SYS1,DSNMIN10,,R,-,AMMSJ16D,AMMSA100,AMMSD100 Some parameters are: PARM 1 - DB2O names DB2 for the attachment to DB2 PARM 7 AMMSJ16D names the DB2 Thread name for attachment to DB2 PARM 8 AMMSA100 names the DB2 Plan for attachment to DB2 PARM 9 AMMSD100 contains the name of the application program invoked by DSNMTV01 22

IMS Attach DFSLI000 BMP Batch Job executes DFSRRC00 but passes Application program name as program to invoke. No restriction on static calls. Execution is not limited to DB2 availability Typically commands passed to through a SYSTSIN DD DSN SYSTEM(DB2O) RUN PROGRAM(ITCP2016) PLAN(ITCP2016) END Commands are serially processed. DSN Command causes the attachment to DB2 WHEN first SQL/CONNECT is encountered RUN Command supplies the DB2 Plan for Attachment / Program is ignored Application program must use DFSLI000 as the Attachment for communication with DB2 END has no meaning 23

CICS Attach DSNCLI Traditional Vanilla CICS DB2 out of the box DSNCLI was an attachment method originally shipped with DB2 but ownership of the module changed hands from DB2 to CICS and is now shipped with CICS. Coordinated commits / Syncpoints Coordinated recovery Same coding as any CICS program (i.e. SYNCPOINT, ROLLBACK, etc.) Connection is made during startup of CICS region. Attachments are by CICS transaction 24

RRSAF Attach DSNRLI Batch Job executes Application program No IKJEFT01 (TSO Monitor program) Execution is not limited to DB2 availability (Implicit connection with Version 8) Ships with DB2 located in DSNLOAD library Coordinated commits/recovery available/ SRRCMIT/SRRBACK Attach Facility specific coding (i.e. IDENTIFY/SIGNON/CREAT THREAD/SRRCMIT/SRRBACK, etc.) Attachments were through specific coding (pre Version 8) now implicit Heavily used in Java applications running under Websphere WLM established address spaces use RRSAF to connect to DB2 A12:DB2 Attachment Facilities - John Maenpaa - Health Care Service Corporation 25

How do we decide Attachment? In a typical installations, a technical support area has at one time setup a compile and link process that determines the Attachment. This would be compile and link JCL supplied stand alone or through a Library Control process. Developers and programmers have tended in the past to be unconcerned with Attachment. 26

Traditional DB2 Compile & Link 27

Rules of the Road One and Only One attachment method can be used by a specific instance or execution of an application to establish a connection to DB2. For Batch, this means the step within the job can only have one attachment method. Once the attachment is established then all attempts to attach with another method will fail. 28

Sounds Good So What s the Problem? 29

Mixed Attachment Errors U0100 A failure occurred during MVS cross-system extended services (XES) DBA0150E - DB2 CONNECTION FAILURE WITH AN UNRCOGNIZED REASCODE. REASON CODE = 00F30049 A request was received to connect the requester's TCB to a DB2 subsystem, but the TCB is already connected. SQL -927 The Language Interface (LI) was called when the connecting environment was not established. The program should be invoked under the DSN command. S04E When the system detects an error in internal IBM Database 2 (DB2^) processing. It will abnormally end a connected user task (TCB) or one of its own internal tasks. For information about the reason associated with this abend code, see DB2 Messages and Codes. 30

So How does that happen? 31

Application Development Strategy 32

Application Development Strategy Application # 1 Presentation layer Business layer Data layer 33

Application Development Strategy IMS DFSLI000 CAF/ DB2 DSNALI IMS / DB2 DFSLI000 TSO/ DB2 DSNELI 34

Application Development Strategy Application # 1 IMS Application Application # 1 DB2 Application IMS DFSLI000 Presentation layer Business layer Presentation layer Business layer CAF/ DB2 DSNALI Data layer Data layer Application # 3 IMS & DB2 Application Application # 1 TSO IKJEFT01 DB2 Application IMS / DB2 DFSLI000 Presentation layer Business layer Presentation layer Business layer TSO/ DB2 DSNELI Data layer Data layer 35

Geez What s the Solution? 36

One Solution Linkage Editor INCLUDE DFSLI000 REPLACE DSNHLI INCLUDE LOAD(RL55D008) ENTRY RL55D008 NAME RL55D008(R) INCLUDE DSNELI REPLACE DSNELI INCLUDE LOAD(RL55D008) ENTRY RL55D008 NAME RL55E008(R) 37

Problems with approach Source and object name mismatches Dual objects for a single source Remembering to Link alternate copy Research into objects with no matching source Confusion about what these link decks accomplish 38

Uggh! Got another Solution? 39

Generic Attach Lack of ANY imbedded Attachment method Determining your Attachment method at Execution Time Originally I called this concept the No Attach method until I read an article by Dan Luksetich of YL&A in which he referred to this technique as Generic Attach. Obviously a much better definition. 40

Generic DB2 Attachment DSNHLI H L I High Level Interface DSNHLI is the standard High level Interface name used in most DB2 attachment call statements. DB2 Attachment is the program called that handles all of the communication with DB2. 41

Generic Attachment Avantages DB2 Connection is established by interface type. Interface is resolved at execution time. Library concatenation determines attachment method used. 42

Traditional DB2 Compile & Link Repeated Slide 43

Generic DB2 Compile & Link 44

BUT How does it work? All Attachment interface calls are to the High Level Interface generic name DSNHLI The call to DSNHLI is dynamic. The library concatenation controls the Attachment method used. DSNHLI should be (if not already) an ALIAS in each of the libraries containing an Attachment method program. 45

Generic DSNHLI ALIAS of DB2 SYS2.DB2.DB2O.EXCP.DSNLOAD Name Prompt Alias-of DSNHLI DSNELI DSNELI IMS SYS2.IMSVS.RESLIB Name Prompt Alias-of DSNHLI DFSLI000 DFSLI000 CAF SYS3.DBATACH.LOADLIB Name Prompt Alias-of DSNHLI DBAHLI DBAHLI ( 3 rd Party contains calls to DSNALI) 46

Advantages of Generic Attach Developer of the DB2 module is now totally unconcerned with the attachment method. Same source / object code module may now be used regardless of Attachment method. Batch Simple JCL library concatenation controls the Attachment method. Developer of the root calling module, who would own the JCL, is now in full control of the Attachment method used (as it should be). 47

Careful if You need co-ordinated or twophased commits between DB2, IMS and MQ updaters. 48

Who Does that? IMS and CICS are two subsystems that are coordinator subsystems. They will coordinate commits between participant subsystems. CICS will act as a coordinator to IMS. (We will just eliminate CICS from further discussion to simplify things. The concepts are the same.) RRSAF also provides this same capability. 49

Power of IMS Attach DB2 is oblivious of updates to others (DB2 does not play well with others.) IMS, on the other hand, does play well with others. IMS will coordinate all of the outstanding commits and issue them across the board (i.e. We all commit or we all fail.) 50

Coordinated/two-phased commits If IMS coordinates commits between IMS, DB2 and MQ, wouldn t that be a three phase commit? NO - Coordinated or two-phased commits works as follows: One system acts as a coordinator of all updates. All other systems are known as participants. At commit time, there is a two-phase process to committing: Phase I - The coordinator notifies each system of an intent to commit. Each system independently determines if enough information has been recorded and whether the outstanding work can be committed. Phase II After all systems have reported back in Phase I that all of the outstanding work can be committed, then the coordinator issues the commit to all systems. Should any system abend during phase II, then the commit operation would complete as part of that systems recovery process. 51

Again If you need coordinated commits use and attachment method that supports coordinated commits such as IMS Attach! 52

What you talking about Willis? Real Life Story A batch application was developed that processes an MQ Queue of messages and updates IMS databases and DB2 tables Main Application Loop Perform until Stop message on Queue Destructive read of the MQ message Call module to perform IMS Updates Call module to perform DB2 Updates Take an IMS checkpoint 53

Setting the scene! Job ran for 24 hours processing MQ messages Hundred s of thousands of messages processed All modules are called dynamically. Bad data on message caused application program to S0C7. 54

No problem! Updates committed! IMS takes care of all coordinated or two-phased commits during checkpoint processing. When a checkpoint is taken IMS commits the destructive read to the MQ Queue, commits the updates to the IMS database and commits the updates to the DB2 tables. Cool Huh! 55

Long Backout! What's Up! Did we mention we were using Call Attach (CAF)? NOTE: IMS coordinates the commit of all DB2 updates IF and only IF IMS knows about them (i.e. DFSLI000) As NONE of the DB2 updates were EVER committed, the job began rolling back 24 hours of DB2 updates and mounting log tapes. 12 hours later the job ended 56

Uh Oh! Never say things cannot get worse! All of the IMS updates had been applied but none of the DB2 updates and the input (MQ) was gone. What do we do now! This mistake was only made once. 57

What did we learn from this! A simple set of Rules IMS programs that read DB2 always use imbedded IMS Attach not Generic attach. IMS Driver programs that will be calling any possible DB2 modules should be modified to be DB2. This is as simple as issuing an SQL Select Current Date in the initialization section. This will establish the Attachment method and will ensure that no subsequent called DB2 module could use an incorrect Attachment method. 58

Real world Currently we have one entire application in production using this process and we have been extremely successful. Four others are partially done. One other application is undergoing this methodology. We have a technical DB2 Attachment committee composed of Database Administration, Database Application Support, Technical Systems Support and Applications to support implementation of this technique as a shop wide standard. 59

Caveat JCL Joblib/Steplib includes One discovery we had was that life is much simpler if batch Jobs are broken down so that all of the steps use the same Attachment method. The Joblib or a Joblib include then easily controls the method. Unfortunately, if you mix methods in different steps then you would need a steplib or steplib include which is a little more awkward. 60

Jack Bailey jack.bailey@bcbssc.com 61