81
IBM Confidential The Best Reliable Partner for High Availability © Copyright IBM Corporation 2008 CICS OTE 환경과 Application Threadsafe 적용 최지원 부장 [email protected] * * ‘2008 하반기 효과적인 시스템 관리를 위한 기술 세미나

CICS OTE 환경과 - DBGuide.net · 2008-11-10 · CICS TS 1.3 implements stage 1 of OTE. In CICS TS 1.3, the base infrastructure of CICS has been changed to eventually allow multiple

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

IBM Confidential

The Best Reliable Partner for High Availability

© Copyright IBM Corporation 2008

CICS OTE 환경과Application 의 Threadsafe적용

최지원부장

[email protected]

**‘2008 하반기효과적인시스템관리를위한기술세미나

IBM Confidential1

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Ⅰ.Ⅰ.

Ⅱ.Ⅱ.

CICS OTE & Threadsafe 적용CICS CICS OTE & OTE & ThreadsafeThreadsafe 적용적용

Open Transaction Environment 소개

Threadsafe Program 정의 & TCB switching

Ⅲ.Ⅲ. Threadsafe 적용 준비 사항

Ⅳ.Ⅳ. Threadsafe 적용 절차

목차

Ⅴ.Ⅴ. Benchmarking Test Case

IBM Confidential2

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Ⅰ.Ⅰ.

Ⅱ.Ⅱ.

CICS OTE & Threadsafe 적용CICS CICS OTE & OTE & ThreadsafeThreadsafe 적용적용

Open Transaction Environment 소개

Threadsafe Program 정의 & TCB switching

Ⅲ.Ⅲ. Threadsafe 적용 준비 사항

Ⅳ.Ⅳ. Threadsafe 적용 절차

Ⅴ.Ⅴ. Benchmarking Test Case

IBM Confidential3

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Introduction to Open Transaction Environment (OTE)Objectives

Enable applications on CICS TS use non CICS APIs

Open CICS TS to new types of client

FunctionAccess to POSIX functions, HLL functions, HFS, sockets

Improved performance for resource manager adapters eg. DB2, MQ

Stage 1 (delivered in CICS TS 1.3)CICS base infrastructure changed

OTE used for JVM and Java Hot Pooling

Stage 2 (delivered in CICS TS 2.2)Support for Task Related User Exits (TRUEs)

Stage 3 (delivered in CICS TS 3.1)Support for OPENAPI programs and C/C++ programs using XPLINK

IBM Confidential4

The Best Reliable Partner for High Availability

© IBM Corporation 2008

NotesExamples of non CICS APIs would be MVS services and MVS Unix System Services POSIX functions.

An example of opening CICS up to new types of client would be that OTE would enable listener tasks written for other platforms to be imported to run under CICS and hence service requests from their relevant clients.

Use of the MVS JVM inside CICS is a good example of migration to new technologies. Open Transaction Environment (OTE) will be implemented over several releases. CICS TS 1.3 implements stage 1 of OTE.

In CICS TS 1.3, the base infrastructure of CICS has been changed to eventually allow multiple TCBs for application use. Also many of the external changes are in place e.g. changes to program definition panels, SIT parameters, options on the ENABLE command but many these changes are 'dormant' in CICS TS 1.3.

In CICS TS 2.2, support for exploitation of OTE by Task Related User Exits was added (stage 2).

In CICS TS 3.1 support has been added for OPENAPI programs that allows applications to request their ownTCB to run on from the start.

OTE necessitates changes in other products such as MVS BCP, MVS Unix System Services, Language Environment (LE), DB2. These also have been delivered over several releases.

IBM Confidential5

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Terminology

Quasi-reentrant (QR) TCBThe main CICS TCB under which all application code runs prior to OTE

CICS dispatcher sub-dispatches work, so each CICS task has a slice of the action

A CICS task gives up control via a CICS dispatcher wait

Only one CICS user task is active at any one time

Quasi-reentrant programsSame program can be invoked by more than one CICS task

• But only one CICS task is active at any one time

Quasi-reentrancy allows programs to share virtual storage e.g. CWA without the need to protect against concurrent update

CICS code takes advantage of quasi-reentrancy, e.g. field CSACDTA in the CSA addresses the TCA of the currently dispatched CICS task.

IBM Confidential6

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Notes

Today prior to OTE, all application code runs under the main CICS TCB called the quasi-reentrant (QR) TCB. The CICS dispatcher subdispatches use of the TCB between the CICS tasks. Each task voluntarily gives up control when it issues a CICS service that issues a CICS dispatcher wait. There is only ever one CICS task active at any one time on the QR TCB.

Programs are said to be quasi-reentrant programs because they take advantage of the behaviour of the CICS dispatcher and the QR TCB, in particular that there is only ever one CICS task active under the QR TCB. This means that although the same program can be being executed by multiple CICS tasks, only one of those CICS tasks is active at any one point in time. Contrast this with a situation whereby multiple instances of the same program are executing each under a separate TCB. In this situation multiple tasks would be active in the same program at the same time and the program would have to be fully MVS reentrant or thread safe.

Quasi reentrant programs can access shared resources such as the common work area (CWA) or shared storage obtained via EXEC CICS GETMAIN SHARED safe in the knowledge that they are the only CICS user task running at that instance.

Field CSACDTA in the CICS CSA is a field that relies on quasi-reentrancy. It points to the TCA of the currently dispatched CICS task. It only has meaning when running under the QR TCB.

IBM Confidential7

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Terminology

Open TCBA new class of CICS TCB available for use by applications

Each TCB is for the sole use of the owning CICS task but can be reused by a later task.

• No subdispatching under Open TCBs, blocking by applications allowed

There are several different types or modes of Open TCB.

CICS dispatcher domain manages a pool of TCBs for each mode

CICS will switch between an Open TCB and the QR TCB as required

Open TCBs are 'daughters' of QR TCB in the overall CICS TCB hierarchy

IBM Confidential8

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Notes

OTE introduces a new class of TCB called an open TCB that can be used by applications. An open TCB is characterised by the fact it is assigned to a CICS task for the life of the CICS task. There is no subdispatching of other CICS tasks under the open TCB. The application can use it to execute under and issue non CICS apirequests that may involve the TCB being blocked, e.g. MVS GETMAIN. Blocking is allowed because only this open TCB is halted, and not the whole of CICS. When the CICS tasks ends, the open TCB can be reused by a different CICS task.

Within the overall class of open TCB there are various modes of TCB. A mode is identified by a two character name.

CICS dispatcher will manage 'pools' of open TCBs, one for each mode.

IBM Confidential9

The Best Reliable Partner for High Availability

© IBM Corporation 2008

IBM Software Group Terminology

Open TCB modesMode J8 is a key 8 TCB used by the CICS-JVM interfaceMode J9 is a key 9 TCB used by the CICS-JVM interface

• Added in CICS TS 2.3

Mode L8 is a key 8 TCB used for OPENAPI TRUEs and OPENAPI programs• support for OPENAPI TRUEs added in CICS TS 2.2, eg the CICS-DB2 interface. • support for OPENAPI PROGRAMS added in CICS TS 3.1

Mode L9 is a key 9 TCB used for OPENAPI programs • Added in CICS TS 3.1

Mode X8 is a key 8 TCB used for XPLINK support• support for XPLINK added in CICS TS 3.1

Mode X9 is a key 9 TCB used for XPLINK support © 2004 IBM Corporation

© 2006 IBM Corporation

Session C35 9

IBM Confidential10

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Notes

Within the overall class of open TCB there are various modes of TCB. A mode is identified by atwo character name.

The J8 open TCB mode is the type of TCB used to execute a Java Virtual machine (JVM) .In CICS TS 2.3 this was expanded to have J9 open TCB which are used to run userkey Javaapplications.

H8 was a open TCB mode used for Java Program objects using Hotpooling.This was supportprovided in CICS TS 1.3 prior to support for the IBM Persistent Reusable JVM (PrJVM).Hotpooling has been removed in CICS TS 3.1.

L8 is an open TCB mode used in CICS TS 2.2 for TRUEs that exploit OTE.In CICS TS 3.1 they are also used for CICS key openapi programs in CICS TS 3.1

L9 is an open TCB used in CICS TS 3.1 for user key openapi programs.

X8 is an open TCB used in CICS TS 3.1 for cics key C or C++ programs using XPLINK.

X9 is an open TCB used in CICS TS 3.1 for user key C or C++ programs using XPLINK.

© 2006 IBM Corporation

Session C35 10

IBM Confidential11

The Best Reliable Partner for High Availability

© IBM Corporation 2008

CICS TS 2.3 TCB hierarchy

Job Step

FO

RO

QR

CO SZ CAVM XRF SL SO RP J8

S8 S8 ….S8

J9 L8 L8

IBM Confidential12

The Best Reliable Partner for High Availability

© IBM Corporation 2008

NotesThe picture shows the overall TCB hierarchy for CICS TS 2.2

Under the QR TCB a number of daughter TCBs can be seen. Multiple J8 TCBs can be seen and represent multiple CICS tasks, each using a JVM. Also multiple L8 TCBs used by the CICS-DB2 Attachment Facility.

Other than the L8 and J8 TCBs, the other TCBs are all CICS system TCBs- FO is the file owning TCB used to offload various file operations

- RO is the resource owning TCB under which program loads are performed

- QR is the main CICS TCB under which applications are subdispatched

- CO is the concurrent TCB used to offload I/O by various domains

- SZ is used for FEPI

- RP is used for ONC RPC calls

- CAVM and XRF are used for XRF support

- SL is the sockets domain listener TCB and SO is used by the Sockets domain

- Multiple S8 TCBs are used by Sockets domain for SSL support

IBM Confidential13

The Best Reliable Partner for High Availability

© IBM Corporation 2008

TerminologyThreadsafe programs

Are capable of being invoked on multiple TCBs concurrently

Are normally read-only, they do not in general overwrite themselves

• Could overwrite themselves if updates are serialised correctly like shared stg

Cannot rely on quasi-reentrancy to serialize access to resources and storage

Must use serialization techniques such as enqueue/dequeue to access shared resources with integrity

All programs accessing a shared resource must be made threadsafe

e.g. an existing program's reliance on quasi-reentrancy to serialise access to the CWA is made invalid if just one other program can run concurrently on another TCB and access the same CWA field

Are sometimes referred to as fully MVS reentrant programs

• MVS reentrant is often misunderstood to mean that programs do not overwrite themselves. We use the term threadsafe to avoid confusion

IBM Confidential14

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Notes

The term THREADSAFE is used in preference to the term 'fully MVS reentrant' as the latter term is often misunderstood to just mean that a program is linkedited with the RENT option and hence is read-only and does not overwrite itself.

For a program to be threadsafe it has to behave correctly when invoked concurrently under multiple execution units, i.e. TCBs. If it accesses shared storage for example it must ensure that updates to shared storage are serialised. If the program overwrites itself then this is a kind of shared storage and has to be serialised accordingly.

IBM Confidential15

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Terminology

CICSAPI - services available today under QR TCBCICS command level application programming interface

CICS system programming interface

CICS Resource Manager Interface (RMI)

CICS Exit Programming Interface (XPI) - for Global User exits

Systems Application Architecture (SAA) Common Programming Interfaces

• CPI-C and CPI-RR

LE callable services

OPENAPI - additional APIs possible under Open TCBsUse of MVS services

Use of a specified set of POSIX services via MVS Unix System Services

IBM Confidential16

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Notes

CICSAPI( or Baseapi ) is the term used to describe the set of services available today prior to OTE.

Openapi is the term used to describe the set of apis available to a program once it is running on an open TCB.

IBM Confidential17

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Terminology

TCB blocking

Today all application code runs under a single TCB, the CICS quasi reentrant (QR) TCB

Non CICS APIs are disallowed because they are likely to issue MVS WAITs which would bring CICS to a halt by blocking the QR TCB

IBM Confidential18

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Notes

Non CICS APIs are disallowed today because all applications run under the QR TCB. A non CICS API may involve performing an operating system wait for example. An MVS wait issued under the QR TCB would halt the QR TCB and hence the whole of CICS until the wait was completed. Such a request is described as a 'blocking' request as it blocks the TCB.

- This is why for example the Resource Manager Interface (RMI) exists. It gives the Resource Managers (via their adapters) a way of offloading the request onto another TCB. This other TCB is then used to access the Resource Manager and non CICS services can be used on this TCB without affecting CICS.

IBM Confidential19

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Enhancements provided by OTE A CICS task can have one or more Open TCBs

Requires that application code and CICS code running under an open TCB is threadsafe

A blocking call under its own TCB will halt just that TCB not CICS

Requires subspaces to work on more than one TCB for transaction isolation

Userkey applications will get an Open TCB mode that creates a key9 TCB

Application will run under a key9 TCB when running in user key

Application will run under a key8 TCB when running in CICS key

CICS will switch between the QR TCB, the open key8 TCB and the open key9 TCB as required

Open TCBs are non essentialOpen TCBs can be terminated without affecting the rest of CICS

IBM Confidential20

The Best Reliable Partner for High Availability

© IBM Corporation 2008

NotesThe main function provided by OTE is the ability to run application code under it own open TCB thereby freeing the application from the constraints applied now due to it running under the CICS QR TCB.

Applications will be able to issue api calls that block the open TCB, but applications will have to be threadsafe as multiple application instances will be able to run concurrently.

CICS will provide the application with several open TCBs (each of a different mode) if necessary to fulfill its requirements. CICS will do the necessary switching between TCBs not the application.

Open TCBs can terminate normally and abnormally without affecting the rest of CICS.

IBM Confidential21

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Enhancements provided by OTE

Exploitation of Open TCBs by Resource Managers

New options on ENABLE command for Task Related User Exits (TRUEs)

Allows TRUEs to be invoked on an Open TCB

Eliminates the need for Adapters to manage their own set of private TCBs

If calling applications are threadsafe this means elimination of TCB switches• Elimination of large number of TCB switches will produce a big performance gain

CICS RMI and CICS Global User Exit interface code made threadsafe

Code for some common CICS API commands made threadsafe- Over time more and more commands will be made threadsafe

IBM Confidential22

The Best Reliable Partner for High Availability

© IBM Corporation 2008

NotesThe RMI is being enhanced to allow Task Related User Exits (TRUEs) to specify that they wish to be invoked on an open TCB. This will allow Resource Manager adapters such as the CICS-DB2 Attachment Facility to avoid having to manage a private set of TCBs onto which requests to the Resource Manager are offloaded. Instead the Resource Manager can be called on the open TCB. This will avoid two TCB switches per Resource Manager request and should produce a significant performance improvement.

- implies that the TRUE has to be threadsafe if it is to use the new function

The CICS code that implements the RMI, and implements the global user exit interface is being made threadsafe, so that it can be called on an open TCB

The following EXEC CICS API and SPI commands in CICS TS 1.3 have been made threadsafe and so can be executed under an open TCB:

- abend, address, assign, handle abend, handle aid, handle condition, ignore, push, pop, enter tracenum, monitor, getmain, freemain, inquire exitprogram, inquire task (without list), link, load, release, return, xctl, all temporary storage commands

The following commands have been made threadsafe in CICS TS 2.2:

- deq, enq, inquire/set db2conn, inquire/set db2entry, inquire/set db2tran, suspend, wait external

The following commands have been made threadsafe in CICS TS 2.3:

- asktime, formattime, change task, all document commands

IBM Confidential23

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Enhancements provided by OTE

XPI enqueue/dequeue function addedTo aid making Global User Exits threadsafe

Support for task cancel and runaway when in 'running‘ status

RDO and SPI changesOption to define a program is quasi-reentrant or threadsafe

Option to define whether a program uses cicsapi (baseapi) or openapi

System definition changesTo limit the number of open TCBs

To force use of QR TCB if required

IBM Confidential24

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Notes

To help global user exits become threadsafe new functions have been added to the XPI. The Enqueue and Dequeue functions use the services of the NQ domain to provide a serialisationcapability for global user exits.

The CICS kernel and dispatcher have been changed to allow CICS tasks to be canceled (and subject to runaway) when in running state if they are not executing cics code. This capability is used in CICS TS 1.3 to provide runaway and task cancel support for JVM programs.

A program will indicate to CICS that it is threadsafe and that it requires an open TCB to run on via options on the program definition.

New options on inquire and set program allow the new program definition keywords to be manipulated.

At the CICS system level, there are new options in the SIT to limit the number of open TCBs in the system, and to force all programs onto the QR TCB if necessary. Again, there are SPI changes to inquire and set system to manipulate the new keywords.

IBM Confidential25

The Best Reliable Partner for High Availability

© IBM Corporation 2008

OTE 관련 SIT Parameter & SPISIT options

MAXOPENTCBS limits the number of open TCBs in the CICS region

After TS V2.2

MAXOPENTCBS limits number of L8 TCBs ( L9 added in V3.1 )

MAXJVMTCBS limits number of JVM TCBs (J8, J9)

FORCEQR = YES|NO overrides CONCURRENCY(THREADSAFE) for programs

SPI commands and CEMT supportINQUIRE SYSTEM MAXOPENTCBS() ACTOPENTCBS() FORCEQR()

SET SYSTEM MAXOPENTCBS() FORCEQR()

INQUIRE PROGRAM CONCURRENCY()

INQUIRE EXITPROGRAM CONCURRENST() APIST()

INQUIRE TASK TCB (ckopen|ukopen|QR|internal)

Monitoring and statisticsMonitoring and statistics have been upgraded to report information on the new open TCBs

IBM Confidential26

The Best Reliable Partner for High Availability

© IBM Corporation 2008

NotesThere are two new SIT keywords. MAXOPENTCBS limits the total number of open TCBs in the CICS region. The FORCEQR keyword allows the new function to be turned off globally, ie forces all programs to run on the QR TCB, thereby overriding the THREADSAFE and OPENAPI keywords on the program definitions. The SPI and CEMT have been upgraded to allow MAXOPENTCBS and FORCEQR to be inquired upon and set. In addition the INQUIRE SYSTEM command will return the number of currently active open tcbs(ACTOPENTCBS). In CICS TS 2.2, the MAXOPENTCBS parameter will be made more granular in that it will apply just to L8 TCBs used for OPENAPI TRUEs and new SIT parameters such as MAXJVMTCBS will be introduced to limit the number of TCBs to be used for JVMs.

INQUIRE PROGRAM will return the setting of CONCURRENCY ( and in a later release the API setting). INQUIRE EXITPROGRAM will return the enable attributes of the TRUE for CONCURRENCY and API.

The INQUIRE TASK command has been upgraded to add a TCB keyword which returns the type of TCB the task is currently running on:

- ckopen says it running on an cics key open TCB

- ukopen says its running on a user key open TCB

- QR says its running on the QR TCB

- internal says its running on some other internal CICS TCB

Monitoring and statistics have been upgraded for OTE.

IBM Confidential27

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Ⅰ.Ⅰ.

Ⅱ.Ⅱ.

CICS OTE & Threadsafe 적용CICS CICS OTE & OTE & ThreadsafeThreadsafe 적용적용

Open Transaction Environment 소개

Threadsafe Program 정의 & TCB switching

Ⅲ.Ⅲ. Threadsafe 적용 준비 사항

Ⅳ.Ⅳ. Threadsafe 적용 절차

Ⅴ.Ⅴ. Benchmarking Test Case

IBM Confidential28

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Program definitions for threadsafe

CONCURRENCY (QUASIRENT | THREADSAFE)Attribute of program. Applies to applications, TRUEs, GLUEs, URMs, PLT

QUASIRENT (the default) means the code must run under QR TCB

THREADSAFE means the code may run under QR or an open TCB

• We say the program can 'float' between TCBs as required

• Must be LE enabled or assembler

Tells CICS if application logic is threadsafe or not

CICS handles threadsafe issues of its API.

API (CICSAPI | OPENAPI) – implemented in CICS TS 3.1Attribute of program. Applies to applications, TRUEs, GLUEs, URMs, PLT

CICSAPI (the default) means the program only uses CICS permitted interfaces

OPENAPI means the program requires an Open TCB to use other APIs

• OPENAPI will require CONCURRENCY(THREADSAFE)

IBM Confidential29

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Notes

The CONCURRENCY keyword has been added to the program definition and defines whether the application program code is threadsafe or not. The default is QUASIRENT meaning that the program is quasi reentrant and will be always be executed on the QR TCB. This is how programs execute today.

A value of THREADSAFE defines that the program is threadsafe and hence can be executed concurrently on multiple TCBs. It can be run on the QR TCB or on an open TCB. We say that the program is capable of 'floating' between TCBs as required, meaning that it can be executed on whatever TCB is running at the time. Apart from assembler programs, programs must be LE enabled in order to float between TCBs.

The CONCURRENCY attribute applies to application programs, task related user exits, global user exits, user replaceable modules and PLT programs. (Task related user exits can override the setting on the program definition via options on the ENABLE command).

In setting the concurrency attribute you are tell CICS whether or not the application code is threadsafe or not. CICS itself handles whether the CICS commands issued by the application are threadsafe or not.

The API keyword has been added in CICS TS 3.1 and defines whether the program is to use the standard CICS apis or open apis. The OPENAPI keyword defines that the program must be given its own open TCB to execute on and requires the program to be threadsafe.

IBM Confidential30

The Best Reliable Partner for High Availability

© IBM Corporation 2008

IBM Software Group

When a DB2 call is issued from a static or dynamically called routine, the CONCURRENCY definition of the program issuing the static/dynamiccall determines the mode used after the DB2 call completes.

A statically called program has no CICS program definition of its own

Called on whatever TCB the calling program is running onCalled programs’s logic needs to be threadsafe if calling program is defined as threadsafe or openapi

A Cobol dynamically called program has a program definition

But it is only used to allow LE to load the program.Called program is branch and linked to on the callers TCBCalled program’s logic needs to be threadsafe if calling program is defined as threadsafe or openapi

© 2004 IBM Corporation ©

2006 IBM Corporation

37

COBOL Static and Dynamic Calls 시주의사항

IBM Confidential31

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Notes

The CONCURRENCY keyword has been added to the program definition and defines whether the application program code is threadsafe or not. The default is QUASIRENT meaning that the program is quasi reentrant and will be always be executed on the QR TCB. This is how programs execute today.

If you define a program with CONCURRENCY(THREADSAFE), all routines which are statically or dynamically called from that program (for example, Cobol routines) must also be coded to threadsafe standards.

When an EXEC CICS LINK command is used to link from one program to another, the program link stack level is incremented. However, a routine which is statically called, or dynamically called, does not involve passing through the CICS command level interface, and so does not cause the program link stack level to be incremented. With Cobol routines, for a static call, a simple branch and link is involved to an address resolved at linkedit time. For a dynamic call, there is a program definition involved, this is required only to allow Language Environment to load the program. After the load, a simple branch and link isexecuted. When a routine is called by either of these methods, CICS does not regard this as a change of program. The program which called the routine is still considered to be executing, and so the program definition for that program is still considered to be the current one. If the program definition for the calling program states CONCURRENCY(THREADSAFE), the called routine must also comply with this specification. Programs with the CONCURRENCY(THREADSAFE) attribute remain on an open TCB when they return from a DB2 call, and this is not appropriate for a program which is not threadsafe. For example, consider the situation where the initial program of a transaction, program A, issues a dynamic call to program B, which is a Cobol routine. Because the CICS command level interface was not involved, CICS is unaware of the call to program B, and considers the current program to be program A. Program B issues a DB2 call. On return from the DB2 call, CICS needs to determine whether the program can remain on the open TCB, or whether the program must switch back to the QR TCB to ensure threadsafeprocessing. To do this, CICS examines the CONCURRENCY attribute of what it considers to be the current program, which is program A. If program A is defined as CONCURRENCY(THREADSAFE), then CICS allows processing to continue on the open TCB. In fact program B is executing, so if processing is to continue safely, program B must be coded to threadsafestandards.

IBM Confidential32

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Program Definitions for Threadsafe Pre 3.1

DEF PROG(THRDSAFE) GROUP(ADDISON)

OVERTYPE TO MODIFY CICS RELEASE = 0620CEDA DEFine PROGram(THRDSAFE) PROGram : THRDSAFE Group : ADDISON DEscription ==> Language ==> CObol | Assembler | Le370 | C | Pli RELoad ==> No No | Yes RESident ==> No No | Yes USAge ==> Normal Normal | Transient USElpacopy ==> No No | Yes Status ==> Enabled Enabled | Disabled RSl : 00 0-24 | Public CEdf ==> Yes Yes | No DAtalocation ==> Below Below | Any EXECKey ==> User User | Cics COncurrency ==> Quasirent Quasirent | Threadsafe

IBM Confidential33

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Program Definitions for Threadsafe 3.1

DEF PROG(THRDSAFE) GROUP(ADDISON) OVERTYPE TO MODIFY CICS RELEASE = 640CEDA DEFine PROGram( THRDSAFE ) PROGram : THRDSAFE Group : ADDISON DEscription ==> Language ==> CObol | Assembler | Le370 | C | Pli RELoad ==> No No | Yes RESident ==> No No | Yes USAge ==> Normal Normal | Transient USElpacopy ==> No No | Yes Status ==> Enabled Enabled | Disabled RSl : 00 0-24 | Public CEdf ==> Yes Yes | No DAtalocation ==> Below Below | Any EXECKey ==> User User | Cics COncurrency ==> Quasirent Quasirent | Threadsafe Api ==> Cicsapi Cicsapi | Openapi

IBM Confidential34

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Program Definition Notes

It's very important to understand the program definition keyword CONCURRENCY(THREADSAFE) is telling CICS the application logic is threadsafe, not whether CICS commands are threadsafe. CICS will ensure threadsafety of CICS API commands. If the command is not threadsafe, execution will be switched to the QR TCB. If the command is threadsafe, execution may remain on the open TCB. In either case, the resource is accessed in a threadsafe manner.

A threadsafe application can use non-threadsafe CICS commands. It will suffer the overhead of TCB switching but resource integrity is maintained.

If a non-threadsafe application is incorrectly defined to CICS as CONCURRENCY(THREADSAFE), the results are unpredictable.

The API parameter was added to the program definition in CICS Transaction Server R3.1. The default is API(CICSAPI) indicating the program is given control in the same manner as prior releases. Specifying API(OPENAPI) indicates CICS is to give control to the program on an OPEN (L8/L9) TCB. API(OPENAPI) requires the CONCURRENCY setting be specified as THREADSAFE.

CICSAPI The program is restricted to use of the CICS permitted application programming interfaces only. Dependent upon the program's CONCURRENCY setting, the application will either always run on the quasi-reentrant (QR) TCB, or if it is defined as threadsafe it may runon whichever TCB in use by CICS at the time which is determined as suitable.

OPENAPI The program is not restricted to the CICS permitted application program interfaces only. CICS will execute the program on its own L8 or L9 mode open TCB dependent upon the EXECKEY setting. If when executing a CICS command, CICS requires a switch to QR TCB, it will return to the open TCB before handing control back to the application program. OPENAPI requires the program to be coded to threadsafe standards and defined with CONCURRENCY(THREADSAFE).

It's important to note, API(OPENAPI) is ignored for GLUEs (Global User Exits).

IBM Confidential35

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Threadsafe API Commands

ABEND

ADDRESS

ASSIGN

DELETEQ TS

DEQ

ENQ

ENTER TRACENUM

FREEMAIN

GETMAIN

HANDLE ABEND

HANDLE AID

HANDLE CONDITION

IGNORE CONDITION

LINK

LOAD

MONITOR

POP HANDLE

PUSH HANDLE

READQ TS

RELEASE

RETURN

SUSPEND

WAIT EXTERNAL

WRITEQ TS

XCTL

CICS TS 2.2

Note: Wait External is Threadsafe, Wait Event is not!

IBM Confidential36

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Threadsafe API Commands

ASKTIME

CHANGE TASK

DOCUMENT CREATE

DOCUMENT INSERT

DOCUMENT RETRIEVE

DOCUMENT SET

FORMATTIME

CICS TS 2.3

IBM Confidential37

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Threadsafe API Commands

CONVERTTIME

DELETE CONTAINER (CHANNEL)

GET CONTAINER (CHANNEL)

INVOKE WEBSERVICE

MOVE CONTAINER (CHANNEL)

PUT CONTAINER (CHANNEL)

SOAPFAULT ADD

SOAPFAULT CREATE

SOAPFAULT DELETE

WEB CONVERSE

WEB CLOSE

WEB OPEN

WEB PARSE URL

WEB RECEIVE (Client)

WEB SEND (Client)

WEB ENDBROWSE FORMFIELD

WEB ENDBROWSE HTTPHEADER

WEB EXTRACT

WEB READ FORMFIELD

WEB READ HTTPHEADER

WEB READNEXT FORMFIELD

WEB READNEXT HTTPHEADER

WEB RECEIVE (Server)

WEB RETRIEVE

WEB SEND (Server)

WEB STARTBROWSE FORMFIELD

WEB STARTBROWSE HTTPHEADER

WEB WRITE HTTPHEADER

CICS TS 3.1 New Commands CICS TS 3.1 Existing Commands

IBM Confidential38

The Best Reliable Partner for High Availability

© IBM Corporation 2008

TCB Mode switch - CICS TS 1.3

ApplicationEXEC CICS

EXEC SQL

EXEC SQL

EXEC CICSEXEC CICSEXEC SQL

EXEC SQL

EXEC CICS RETURN

DB2 Attach Code

QR TCB DB2 Attach TCB

IBM Confidential39

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Notes

The diagram shows what happens in CICS TS 1.3 when running a CICS DB2 application containing both EXEC CICS commands and EXEC SQL commands. In particular it is showing the TCB switching that goes on when executing DB2 calls.

The CICS-DB2 Attach has to manage its own set of private TCBs onto which is offloaded the DB2 request. The DB2 Attach TCB is the one under which calls are made to DB2 as we cannot use the QR TCB, as it would be blocked by the DB2 request.

For each EXEC SQL request there are two TCB switches, one to offload the request onto the DB2 Attach TCB, another TCB switch to return control to the application on the QR TCB when the DB2 request has completed.

In total there are twelve TCB switches (four for the two phase commit end of task syncpoint). Contrast this with the next page showing how the CICS-DB2 Attachment facility exploits OTE in CICS TS 2.2.

IBM Confidential40

The Best Reliable Partner for High Availability

© IBM Corporation 2008

TCB Mode switch - CICS TS 2.2 threadsafe application

Application

EXEC CICS

Non-ThreadsafeEXEC CICS

DB2 Attach code

EXEC SQLEXEC SQL

Threadsafe EXEC CICS

EXEC SQLEXEC SQL

EXEC CICS RETURN

QR TCB DB2 Attach TCB

IBM Confidential41

The Best Reliable Partner for High Availability

© IBM Corporation 2008

NotesThe picture shows how the CICS-DB2 Attachment facility has been upgraded in CICS TS 2.2 to takeadvantage of OTE and use an open TCB to call DB2 (when using DB2 V6 or higher) rather than one of its own privately managed TCBs. The scenario assumes the CICS DB2 TRUE has been enabled with the THREADSAFE and OPENAPI keywords and that the calling application is threadsafe and been defined as such on the program definition.

The first EXEC CICS command is executed under QR. When executing the first EXEC SQL request, the TRUE is invoked on an open TCB, and that TCB is used to call DB2. On return from the RMI because the application is defined as threadsafe we stay on the open TCB and return to the application on it. For the next EXEC SQL request we stay on the open TCB. Next is a threadsafe EXEC CICS command, so we can stay on the open TCB. Next is a non threadsafe command and so we have to switch to QR to execute that request. For the next SQL request we return to the open TCB. For EXEC CICS RETURN we return to QR TCB followed by the four TCB switches for the syncpoint two phase commit protocol.

It can be seen that the number of TCB switches is reduced in this environment. One thing to avoid is to intersperse CICS commands that are not threadsafe in between EXEC SQL commands as this will cause excessive TCB switching.

Whilst in this simple example we would only reduce the number of TCB switches from 12 to 8 the reduction is more dramatic when you consider a heavy DB2 application that does 100 EXEC SQL requests that today would incur 204 TCBs switches. If the DB2 Attachment Facility were to exploit OTE this can be reduced to 6 TCB switches and would make it as efficient as a DB2 stored procedure.

IBM Confidential42

The Best Reliable Partner for High Availability

© IBM Corporation 2008

TCB Mode switch - CICS TS 3.1CICS TS V3 – TCB Switching

IBM Confidential43

The Best Reliable Partner for High Availability

© IBM Corporation 2008

NotesIn CICS Transaction Server R3.1, a program may be defined with the OPENAPI keyword, to indicate it should execute on an OPEN TCB (L8 or an L9, based on the EXECKEY specification). However, it should be noted all non-threadsafecommands will continue to be processed on the QR TCB.

On the prior page notice the program used for transaction BLUE is defined as THREADSAFE, with API=CICSAPI. The execution of the task and TCB switching is the same as CICS Transaction Server R2.2 and R2.3. The program executes on the QR TCB until it issues an DB2 request, at which point it will switch to an L8 TCB. It will remain on the L8 until a non-threadsafe command is issued, causing it to switch back to the QR where it will remain until an other SQL request is issued.

The application used for transaction RED is defined THREADSAFE, with API=OPENAPI and EXECKEY=CICS. The program is given control on an L8 TCB. Each time it issues a non-threadsafe command it will switch to the QR TCB to process the command and then return control to the application on the L8 TCB. SQL commands are executed on the L8 TCB along with any threadsafe commands. Notice, if there are many non-threadsafecommands, the overhead of switching can be greater than running with API=CICSAPI.

Another important point to consider. If the program for transaction RED had been defined to run in EXECKEY USER, it will be given control on an L9 TCB, rather than an L8. The processing will be the same as noted above, EXCEPT when an SQL call is issued, the task is switched to an L8 TCB. Upon completion of the SQL request, control will be returned to the application on the L9 TCB.

© 2006 IBM Corporation

IBM Confidential44

The Best Reliable Partner for High Availability

© IBM Corporation 2008

TCB Mode switch - CICS TS 3.1

User Key OPENAPI CICS-DB2 application Do not use if possible

IBM Confidential45

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Ⅰ.Ⅰ.

Ⅱ.Ⅱ.

CICS OTE & Threadsafe 적용CICS CICS OTE & OTE & ThreadsafeThreadsafe 적용적용

Open Transaction Environment 소개

Threadsafe Program 정의 & TCB switching

Ⅲ.Ⅲ. Threadsafe 적용 준비 사항

Ⅳ.Ⅳ. Threadsafe 적용 절차

Ⅴ.Ⅴ. Benchmarking Test Case

IBM Confidential46

The Best Reliable Partner for High Availability

© IBM Corporation 2008

How to prepare for OTEGlobal User Exits (GLUEs)

Should be made THREADSAFE else excessive TCB switching will occur

• CICS will be forced to switch to QR TCB from an open TCB to invoke a non threadsafeGLUE

• Particularly important exits that need to be threadsafe are XRMIIN and XRMIOUT on the RMI path, and XEIIN/XEIOUT called for all CICS requests. If running Omegamonapply apar QC26070

• Check with vendors for threadsafe support

• Use DFH0STAT to find out what exits are in use and if they are threadsafe

Can use DFHNQEDX ENQUEUE and DEQUEUE to serialise access to shared areas like the Global work area (GWA)

EXEC capable GLUEs can use HANDLE ABEND routines to release enqueues in recovery situations

Warning: You can no longer rely on field CSACDTA to access the TCA of the current CICS task - only works when running under QR TCB

IBM Confidential47

The Best Reliable Partner for High Availability

© IBM Corporation 2008

NotesTo take advantage of OTE, especially for heavy CICS-DB2 applications, work needs to be done.This comes in the form of making Global user exits and applications threadsafe. and defining them to CICS as threadsafe. (Also the same applies to TRUEs, if you have any).

If a Global user exit program is not threadsafe and has to be defined as QUASIRENT, then every time it is invoked from an exit point within threadsafe CICS code, if CICS is currently running on an open TCB, it will have to switch to QR to execute the Global User Exit. Excessive TCB switching for GLUEs will degrade performance and negate some of the advantages provided by OTE.

CICS has provided new XPI function to allow GLUEs to serialise access to shared storage such as the Global work area (GWA). For EXEC capable GLUEs, code should be added to a HANDLE ABEND routines to DEQUEUE in error situations. For GLUEs that cannot be EXEC capable, CICS will release any enqueues at task termination in error situations.

Field CSACDTA in the CICS CSA cannot be used to access the TCA of the currently dispatched CICS task unless running on the QR TCB.

- The XPI should be used you obtain information about the transaction.

IBM Confidential48

The Best Reliable Partner for High Availability

© IBM Corporation 2008

How to prepare for OTE

Make applications threadsafeCICS will ensure threadsafe access to its managed resources ...

• Vsam files, TS, TD, etc as well as DLI databases, DB2 tables

Applications have to ensure threadsafe access to their resources ...

• CWA, Shared storage, ...

Ensure applications are read-only ...

Test by putting them in CICS read only DSAs

Serialize access to shared resources such as the CWA or shared storage acquired via use of EXEC CICS GETMAIN SHARED

In CICS TS 2.2, use the load module scanner to look for use of global storage

Use services such as EXEC CICS ENQUEUE and DEQUEUE or

In assembler programs use compare and swap instructions or

Perform access to shared resources in a QUASIRENT program that is EXEC CICS LINKed to.

IBM Confidential49

The Best Reliable Partner for High Availability

© IBM Corporation 2008

NotesAs shown in the previous DB2 example, applications need to be made threadsafe in order to exploit OTE, be that because they want to use openapis or if they want to take advantage of performance improvements provided by OTE due to less TCB switching.

CICS will provide threadsafe access to resources it manages even if for the time being this nvolves switching to QR to serialise the access. Over time more and more resources will be accessed directly under the open TCB.

Applications have to worry about concurrent access to their resources such as shared storage. Unless an application requires to overwrite itself (in which case t has to provide serialization of such code - it is a type of shared storage) then ensure applications are readonly. The CICS readonly DSA can be used to ensure this.

CICS TS 2.2 provides a load module scanner utility with a sample table called DFHEIDTH which looks for applications that issues EXEC CICS ADDRESS CWA, EXEC CICS GETMAIN SHARED or EXEC CICS EXTRACT EXIT. All these commands give access to shared storage and hence have the potential for the application logic not being threadsafe if the storage is not subsequently updated in a threadsafe way.

Applications can use ENQUEUE and DEQUEUE to serialise updates to shared storage. In assembler applications compare and swap instructions can be used. Access to shared resources could be funneled through one program which is defined as QUASIRENT - incurs TCB switching penalties.

IBM Confidential50

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Ⅰ.Ⅰ.

Ⅱ.Ⅱ.

CICS OTE & Threadsafe 적용CICS CICS OTE & OTE & ThreadsafeThreadsafe 적용적용

Open Transaction Environment 소개

Threadsafe Program 정의 & TCB switching

Ⅲ.Ⅲ. Threadsafe 적용 준비 사항

Ⅳ.Ⅳ. Threadsafe 적용 절차

Ⅴ.Ⅴ. Benchmarking Test Case

IBM Confidential51

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Threadsafe적용절차

Step 1. Make your Application Program to be threadsafeDFHEISUP utility 수행

Application 을 Read Only DSA 에 Load 하여수행

필요시 Application 업무개발팀의확인

Step 2. Check your exit program to be threadsafeDFH0STAT 으로확인

Step 3. Define program as threadsafe

Step 4. Check CHANGEMODE count

Step 5. Check CICS TRACE for unexpected case

IBM Confidential52

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 1. DFHEISUP 수행DFHEISUP

IBM-supplied sample program provided in SDFHSAMP as DFHEILMS

Sample filters also are provided in SDFHSAMP

Filter DFHEIDTHAs provided, looks for CICS commands that give access to shared storage

EXTRACT EXIT

GETMAIN SHARED

ADDRESS CWA

- Can be modified to look for other CICS commands

Filter DFHEIDNTContains the filter set for CICS commands that are not threadsafe and will cause a switch to the QR TCB

IBM Confidential53

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 1-a. DFHEISUP 수행

DFHEISUP can provide a summary report of the modules scanned- Summary report can be used as input for a detailed report

//DFHSCAN EXEC PGM=DFHEISUP,PARM=('SUMMARY,DETAILMODS'),REGION=512M //*********************************************************************//* Sample JCL for running the Load Module Scanner *//* The CICS Operations and Utilities Guide contains a detailed *//* description of the Load Module Scanner *//* *//*********************************************************************//STEPLIB DD DSN=CTS220.CICS620.SDFHLOAD,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSERR DD SYSOUT=* //DFHFLTR DD DSN=CTS220.CICS620.SDFHSAMP(DFHEIDTH),DISP=SHR //DFHDTL DD DSN=USASSC1.MODL,DISP=OLD //DFHIN DD DSN=USASSC1.CICSR620.P1LIB,DISP=SHR

Note: Program names found will be put into dataset named on DFHDTLPrograms scanned are in dataset named on DFHIN

IBM Confidential54

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 1-a. DFHEISUP 수행

Output from DFHEISUP ‘Summary,DetailMods’

CICS LOAD MODULE SCANNER UTILITY SCAN PERFORMED ON Tue Jan 11 19:58:38 2005 USING TABLE RSTABLE2.2

SUMMARY LISTING OF USASSC1.CICSR620.P1LIB ===================================== Module Name Commands Found Language 'USASSC1.CICSR620.P1LIB(SQLASM)' 1 Assembler 'USASSC1.CICSR620.P1LIB(SQLASM1)' 1 Assembler 'USASSC1.CICSR620.P1LIB(SQLASM2)' 1 Assembler

LOAD LIBRARY STATISTICS ======================= Total modules in library = 349 Total modules Scanned = 349 Total CICS modules/tables not scanned = 0 Total modules possibly containing requested commands = 3

IBM Confidential55

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 1-a. DFHEISUP 수행

Use the output from DFHEISUP ‘Summary,DetailMods’ as input for Detail Report

//DFHSCAN EXEC PGM=DFHEISUP,PARM=('DETAIL'),REGION=512M //********************************************************************* //* * //* Sample JCL for running the Load Module Scanner * //* *//* The CICS Operations and Utilities Guide contains a detailed *//* description of the Load Module Scanner *//*********************************************************************//STEPLIB DD DSN=CTS220.CICS620.SDFHLOAD,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSERR DD SYSOUT=* //DFHFLTR DD DSN=CTS220.CICS620.SDFHSAMP(DFHEIDTH),DISP=SHR //DFHLIST DD DSN=USASSC1.MODL,DISP=SHR //DFHIN DD DSN=USASSC1.CICSR620.P1LIB,DISP=SHR

Note: DFHLIST dataset contains programs found by ‘Summary,Detailmods’

You can use PARM=(‘DETAIL,ALL’) without DD DFHLIST to createDetail Report for all programs contained in DFHIN dataset

IBM Confidential56

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 1-a. DFHEISUP 수행Output from DFHEISUP ‘Detail’

CICS LOAD MODULE SCANNER UTILITY SCAN PERFORMED ON Tue Jan 11 20:17:29 2005 USING Table RSTABLE2.2 DETAILED LISTING OF DD:DFHLIST ===================================== Module Name 'USASSC1.CICSR620.P1LIB(SQLASM)' Module Language Assembler Offset/EDF Command ----------------- ------------------------------------------00000934/no-edf ADDRESS CWA

Module Name 'USASSC1.CICSR620.P1LIB(SQLASM1)' Module Language Assembler Offset/EDF Command ----------------- ------------------------------------------00001028/no-edf ADDRESS CWA

Module Name 'USASSC1.CICSR620.P1LIB(SQLASM2)' Module Language Assembler Offset/EDF Command ----------------- ------------------------------------------00001036/no-edf ADDRESS CWA

Total possible commands located = 3

LOAD LIBRARY STATISTICS ======================= Total modules in library = 3 Total modules Scanned = 3 Total CICS modules/tables not scanned = 0 Total modules possibly containing requested commands = 3

IBM Confidential57

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 1-b. Application 의 Read Only 점검

Put your Application Program into Read Only DSA and Test by:

Linkedit Application with ‘RENT’ OptionDFHSIT Parameter RENTPGM=PROTECT

• Specifies you want CICS to allocate the read-only DSAs ( RDSA and ERDSA) from read-only key-0 protected storage

• RDSA for RMODE(24) programs and the ERDSA for RMODE(ANY) programs

Any attempt to overwrite the program will result in message DFHSR0622 and an ABEND0C4

Programs running in key-zero or supervisor state can still overlay RDSA and ERDSA

DFHSR0622 An attempt to overwrite the RDSA has caused the abend which follows

DFHAP0001 An abend (code 0C4/AKEA) has occurred at offset X'00000ACC‘in module SQLSPIN.

IBM Confidential58

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 1-b. Application 의 Read Only 점검

KSCONV program 사용시주의사항

KSCONV 은자신의 program 영역을 Overwrite 하므로 Threadsafe하지않음.

KSCONV 를 Static Call 하는 program 을 Read Only DSA 에 Load 하고사용할경우

ABEND0C4 발생함.

KSCONV 를 CALL 하는 program 은 Qusirent로정의하여야함.

KSCONV program 사용자는장기적으로다른 Code Conversion Program 으로대체하여야함.

IBM Confidential59

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 2 . DFH0STAT 으로 User Exit 점검

Sample Program - CICS Statistics Print 01/29/2005 14:21:14

Type in destination fields if required. Press Enter to print

Jobname. . . : IYNXV Applid . . . : IYNXV Sysid. . . . : ISC1

Node . . . . . * Type in a valid Node. * is defaultUserid . . . . * Type in a valid Userid. * is default Class. . . . . A Type in a valid Class. A is default

Abbreviated. . B Type U or N for abbreviated report. B is default

Current Statistics Settings

Statistics Recording. : ON Collection Interval . . . : 03:00:00 Last Reset Time . . . : 12:00:00 Elapsed Time Since Reset. : 02:21:14 Next Collection . . . : 15:00:00 End-of-Day Time . . . . . : 00:00:00

F1=Help F2=Refresh F3=Exit F4=Report Selection F5=Print

Install Group DFH$STAT from DFHCSD and run Transaction STAT

IBM Confidential60

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 2 . DFH0STAT 으로 User Exit 점검

Sample Program - CICS Statistics Print Report Selection 01/29/2005 14:21:39

Select the statistics reports required and press 'Enter' to validate

DB2 Connection . . . . . . . . . . Y DB2 Entries. . . . . . . . . . . . Y

Program Autoinstall. . . . . . . . N Terminal Autoinstall and VTAM. . . N

Connections and Modenames. . . . . N

Enqueue Manager. . . . . . . . . . N Enqueue Models . . . . . . . . . . N

Recovery Manager . . . . . . . . . N

User Exit Programs . . . . . . . . Y Global User Exits. . . . . . . . . Y

F1=Help F3=Return to Print F7=Back F10=Save F12=Restore

Ensure you select DB2 Connection and EntriesEnsure you select User Exits and Global User Exits

IBM Confidential61

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 2 . DFH0STAT 으로 User Exit 점검

Sample Program - CICS Statistics Print 01/29/2005 14:22:43

Type in destination fields if required. Press Enter to print

Jobname. . . : IYNXV Applid . . . : IYNXV Sysid. . . . : ISC1

Node . . . . . * Type in a valid Node. * is defaultUserid . . . . * Type in a valid Userid. * is default Class. . . . . A Type in a valid Class. A is default

Abbreviated. . B Type U or N for abbreviated report. B is default

Current Statistics Settings

Statistics Recording. : ON Collection Interval . . . : 03:00:00 Last Reset Time . . . : 15:00:00 Elapsed Time Since Reset. : 00:02:42 Next Collection . . . : 18:00:00 End-of-Day Time . . . . . : 00:00:00

Statistics print successfully completedF1=Help F2=Refresh F3=Exit F4=Report Selection F5=Print

IBM Confidential62

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 2 . DFH0STAT 으로 User Exit 점검

User Exit Programs__________________

<---- Global Area ----> No. Program Entry Entry Use of Program Program Exit Program Name Name Name Length Count Exits Status Concurrency Use Count

_______________________________________________________________________________________ DFHEDP DLI 0 0 0 Started Quasi Rent 0 DFHD2EX1 DSNCSQL DSNCSQL 16 1 0 Started Quasi Rent 234 EDZEXIT EDZEXIT 0 0 1 Started Quasi Rent 234EDZEXIT2 EDZEXIT2 EDZEXIT2 64 1 1 Started Thread Safe 234

Applid IYNXV Sysid ISC1 Jobname IYNXV Date 01/28/2005 Time 14:22:43 CICS 6.2.0 ____________________________________________________________________________________________________________Program Entry Concurrency <------- Task Related User Exit Options --------> Name Name API Status Qualifier Length Taskstart EDF Shutdown Indoubt SPI Purgeable

____________________________________________________________________________________________________________ DFHEDP DLI Base Quasi Rent 284 No No No No Wait No No DFHD2EX1 DSNCSQL Open Thread Safe DF23 222 No Yes Yes Wait Yes Yes EDZEXIT EDZEXIT Base Thread Safe 0 No No No No Wait No No EDZEXIT2 EDZEXIT2 Base Thread Safe 0 No No No No Wait No No

Applid IYNXV Sysid ISC1 Jobname IYNXV Date 01/29/2005 Time 14:22:43 CICS 6.2.0

User Exit Report

IBM Confidential63

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 2 . DFH0STAT 으로 User Exit 점검

Global User ExitsExit Program Entry <------- Global Area -------> Number Program ProgramName Name Name Entry Name Length Use Count of Exits Status Concurrency

___________________________________________________________________________________________ XRMIIN EDZEXIT EDZEXIT 0 0 1 Started Quasi Rent XRMIIN EDZEXIT2 EDZEXIT2 64 0 1 Started Thread Safe XRMOUT EDZEXIT EDZEXIT 0 0 1 Started Quasi Rent XRMOUT EDZEXIT2 EDZEXIT2 64 0 1 Started Thread Safe

Global User Exit Report

IBM Confidential64

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 2 . DFH0STAT 으로 User Exit 점검

DB2 Connection ______________ DB2 Connection Name. . . . . . . . . . . : DF23 DB2 Group Id . . . . . . . . . . . . . . : Resync Group Member . . . . . . . . . .: N/A DB2 Sysid. . . . . . . . . . . . . . . . : DF23 DB2 Release. . . . . . . . . . . . . . . : 7.1.0 DB2 Connection Status. . . . . . . . . . : CONNECTED DB2 Connect Date/Time: 01/28/2005 15:18:04 DB2 Connection Error . . . . . . . . . . : SQLCODE DB2 Standby Mode . . . . . . . . . . . . : RECONNECT DB2 Pool Thread Plan Name. . . . . . . . : DB2 Pool Thread Dynamic Plan Exit Name . : DSNCUEXTPool Thread Authtype . . . . . . . . . . : USERID Command Thread Authtype . . . . . . . : USERID Pool Thread Authid . . . . . . . . . . . : Command Thread Authid . . . . . . . . .: Signid for Pool/Entry/Command Threads. . : IYNXV Create Thread Error. . . . . . . . . . . : N906D Message TD Queue 1. . . . . . . . . . .: CDB2 Protected Thread Purge Cycle . . . . . . : 00.30 Message TD Queue 2. . . . . . . . . . .: Deadlock Resolution. . . . . . . . . . . : ROLLBACK Message TD Queue 3. . . . . . . . . . .: Non-Terminal Intermediate Syncpoint. . . : RELEASE Pool Thread Wait Setting . . . . . . . . : WAIT Statistics TD Queue . . . . . . . . . .: CDB2 Pool Thread Priority . . . . . . . . . . : HIGH DB2 Accounting records by . . . . . . .: NONE Current TCB Limit. . . . . . . . . . . . : 12 Pool Thread Limit. . . . . . . . . . . . : 3 Number of Calls using Pool Threads. . .: 0 Current number of Pool Threads . . . . . : 0 Number of Pool Thread Signons . . . . .: 0 Peak number of Pool Threads. . . . . . . : 0 Number of Pool Thread Partial Signons .: 0 Number of Pool Thread Waits. . . . . . . : 0 Number of Pool Thread Commits . . . . .: 0

Number of Pool Thread Aborts. . . . . .: 0 Current number of Pool Tasks . . . . . . : 0 Number of Pool Thread Single Phase. . .: 0 Peak number of Pool Tasks. . . . . . . . : 0 Number of Pool Thread Reuses. . . . . .: 0 Current Total number of Pool Tasks . . . : 0 Number of Pool Thread Terminates. . . .: 0 Current number of Tasks on Pool Readyq . : 0 Peak number of Tasks on Pool Readyq. . . : 0 Current number of DSNC Command threads . : 0 Number of DSNC Command Calls. . . . . .: 0 Peak number of DSNC Command threads. . . : 0 Number of DSNC Command Signons. . . . .: 0 DSNC Command Thread Limit. . . . . . . . : 1 Number of DSNC Command Thread Terminates: 0

DB2 Connection Report

IBM Confidential65

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 2 . DFH0STAT 으로 User Exit 점검

OBJECT CHARACTERISTICS CICS RELEASE = 0620 CEDA View PROGram( DSNCUEXT ) PROGram : DSNCUEXT Group : DFHCOMP6 DEscription : CICS-DB2 DYNAMIC PLAN SELECTION EXIT Language : Assembler CObol | Assembler | Le370 | C | Pli RELoad : No No | Yes RESident : No No | Yes USAge : Normal Normal | Transient USElpacopy : No No | Yes Status : Enabled Enabled | Disabled RSl : 00 0-24 | Public CEdf : No Yes | No DAtalocation : Below Below | Any EXECKey : Cics User | Cics COncurrency : Quasirent Quasirent | Threadsafe

REMOTE ATTRIBUTES DYnamic : No No | Yes

+ REMOTESystem :

Note: PQ67351 provided Threadsafe Dynamic Plan Exit DFHD2PXT

CEDA V PROGRAM(DSNCUEXT)

IBM Confidential66

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 3. Define program as threadsafe

DEF PROG(THRDSAFE) GROUP(ADDISON) OVERTYPE TO MODIFY CICS RELEASE = 640CEDA DEFine PROGram( THRDSAFE ) PROGram : THRDSAFE Group : ADDISON DEscription ==> Language ==> CObol | Assembler | Le370 | C | Pli RELoad ==> No No | Yes RESident ==> No No | Yes USAge ==> Normal Normal | Transient USElpacopy ==> No No | Yes Status ==> Enabled Enabled | Disabled RSl : 00 0-24 | Public CEdf ==> Yes Yes | No DAtalocation ==> Below Below | Any EXECKey ==> User User | Cics COncurrency ==> Threadsafe Quasirent | Threadsafe Api ==> Cicsapi Cicsapi | Openapi

Program Definition

IBM Confidential67

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 4. Check CHANGEMODE count

Compare CHANGEMODE count with SQL call count

978140.903 49 0.127 0.937 0.946 28aaaa

2168730.660 49 0.127 0.699 5.138 529999

660.369 52 0.134 0.372 0.384 338888

461411.651 60 0.157 11.656 11.686 287777

58200.714 62 0.161 0.699 0.782 926666

71140.893 111 0.289 0.898 0.955 245555

245242.753 239 0.621 2.746 2.877 5494444

439623746.116 395 1.028 4.259 6.987 533333

90148.976 494 1.284 8.984 9.034 312222

674813372242.644 1164 3.027 219.305 796.978 81111

DB2 ReqsChangeModeRMI ElapMipsUser CPUDispatchResponse#TasksTran

IBM Confidential68

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Step 5. Check CICS TRACE for unexpected case

00328 L8000 SM 0301 SMGF ENTRY GETMAIN 1AAB2944 , 000000EA,YES,00328 L8000 SM 0302 SMGF EXIT GETMAIN/OK 1B7C8030 00328 L8000 DD 0201 DDDI ENTRY ADD_ENTRY 1B7C8030 , C4F2C3E2,1B7C00328 L8000 SM 0301 SMGF ENTRY GETMAIN 1AAB30D4 , 000000F8,1C,Y00328 L8000 SM 0302 SMGF EXIT GETMAIN/OK 1B7CA030 00328 L8000 LM 0003 LMLM ENTRY LOCK 1AAC5358,EXCLUSIVE 00328 L8000 LM 0004 LMLM EXIT LOCK/OK 00328 L8000 LM 0003 LMLM ENTRY UNLOCK 1AAC5358,EXCLUSIVE 00328 L8000 LM 0004 LMLM EXIT UNLOCK/OK 00328 L8000 DD 0202 DDDI EXIT ADD_ENTRY/OK 00328 L8000 AP 3250 D2D2 ENTRY DB2_API_CALL 1B7C8030 00328 L8000 AP 3251 D2D2 EXIT DB2_API_CALL/OK 00328 L8000 AP 3181 D2EX1 EXIT APPLICATION-REQUEST SQLCODE 0 RETURNED ON EX00328 L8000 RM 0301 RMLN ENTRY SET_LINK 01170002,1B7531EC , 92FF00328 L8000 RM 0302 RMLN EXIT SET_LINK/OK 1B7531EC , 92FF7EC4 , 0000328 QR AP 2521 ERM EXIT COBOL-APPLICATION-CALL-TO-TRUE(DSNCSQL ) 00328 QR AP 2520 ERM ENTRY COBOL-APPLICATION-CALL-TO-TRUE(DSNCSQL ) 00328 L8000 AP 3180 D2EX1 ENTRY APPLICATION REQUEST EXEC SQL FETCH 00328 L8000 AP 3250 D2D2 ENTRY DB2_API_CALL 1B7C8030 00328 L8000 AP 3251 D2D2 EXIT DB2_API_CALL/OK 00328 L8000 AP 3181 D2EX1 EXIT APPLICATION-REQUEST SQLCODE 0 RETURNED ON EX00328 QR AP 2521 ERM EXIT COBOL-APPLICATION-CALL-TO-TRUE(DSNCSQL )

CICS TRACE

IBM Confidential69

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Ⅰ.Ⅰ.

Ⅱ.Ⅱ.

CICS OTE & Threadsafe 적용CICS CICS OTE & OTE & ThreadsafeThreadsafe 적용적용

Open Transaction Environment 소개

Threadsafe Program 정의 & TCB switching

Ⅲ.Ⅲ. Threadsafe 적용 준비 사항

Ⅳ.Ⅳ. Threadsafe 적용 절차

Ⅴ.Ⅴ. Benchmarking Test Case

IBM Confidential70

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Benchmark case 1

Environment of benchmark case 1Hardware resources

• A zSeries environment based on Z900 Processors hosting the CICS application

servers and the DB2 databases.

• DASD subsystem was a 2105-800 ESS with 3.3 TB.

Software resources• zOS 1.3

• CICS Transaction Server for zOS V2.2

• DB2 UDB for zOS V7

• CoreBank V4 application ( Fidelity Information Services )

Configuration• The following configuration was used for the threadsafe versus quasirent comparison:

• zOS,LPAR

• Based on zOS 1.3 with 1 LPAR

• CICSplex

IBM Confidential71

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Benchmark case 1

Task number : Total 27,000 tasks

Tran Environment - SQL call count by TRAN

IBM Confidential72

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Benchmark case 1

IBM Confidential73

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Benchmark case 1

Response time of each tran shows improvement of 60 ~ 80 %

IBM Confidential74

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Benchmark case 1Total CPU time shows improvement of 8%

IBM Confidential75

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Benchmark case 2

Environment of benchmark case 2

Hardware resources • A zSeries environment based on Z900 Processors hosting the CICS application

servers and the DB2 databases.

• DASD subsystem was a ESS with 6.6 TB.

Software resources• zOS 1.4

• CICS Transaction Server for zOS V2.2

• DB2 UDB for zOS V7

• Alnova Financial Solution

Configuration• The following configuration was used for the threadsafe versus quasirent comparison:

• zOS,LPAR

• Based on zOS 1.3 with 2 LPAR

• CICSplex

IBM Confidential76

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Benchmark case 2

IBM Confidential77

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Benchmark case 2

Response time of each tran shows improvement of 60~ 80 %

IBM Confidential78

The Best Reliable Partner for High Availability

© IBM Corporation 2008

Benchmark case 2

Total CPU time shows improvement of 4.9 %

IBM Confidential79

The Best Reliable Partner for High Availability

© IBM Corporation 2008

CPU 감소예측공식

This is not formal formula, derived from test csaeThe instruction saved per TCB switch is approximately 5000 assembler instructions.

( 0.005 Mips )

예측공식 (example)

My company’s average SQL call count is 100 ( then, CHANGEMODE will be

200 ) and average CPU path length is 10 Mips.

After move to threadsafe, average Changemode count is 40, then

CPU saves by threadsafe will be :

0.005 x (100 x 2 – 40) = 0.8 mips

Total CPU save will be 8 %

IBM Confidential80

The Best Reliable Partner for High Availability

© IBM Corporation 2008

감사합니다.감사합니다.Q & A