"DB2 CICS Interface" (PowerPoint 0.5 MB)
Transcript of "DB2 CICS Interface" (PowerPoint 0.5 MB)
Information Management
Computer Consultant Company
DB2 / CICS InterfaceA View of the Interface between DB2/CICS
Patricia Townsend,Computer Consultant Company
Information Management
Computer Consultant Company2
Agenda
Overview of CICS Program Flow
Review of CICS / DB2 Options
Review DB2 thread management concepts
Review DB2 BIND Options - Packages
CICS/DB2 Thread – Reuse Benefits
Evaluate Thread Reuse
Information Management
Computer Consultant Company3
Overview of CICS Program Flow
CICS Program Flow options– Start a CICS transaction – executed a CICS program– Program executes SQL which requires a DB2 DBRM– Program wants to XCTL or LINK to another CICS program– CICS linkage switches control to new program– At termination, each CICS program returns control
CICS Return– CICS returns control to next higher level program
Error Handling Processing– Each program level executes error handling routines– Control is given to next higher level program
Abend processing – Each program level executes abend routines– Control is given to next higher level program– DB2 UOW is managed with CICS UOW– CICS controls DB2 back out as required
Information Management
Computer Consultant Company4
Review CICS relating to DB2 using Threads
DB2 communicates to batch and on-line regions through use of threads.
– Threads are made up of control blocks that anchor the request to the requestor
– Batch acquires/releases threads according to program BIND
– CICS also acquires/ releases based on BIND options and CICS specifications
CICS provides for PROTECTED threads which are re-usuable.
A PROTECTED thread remains available for reuse based on CICS parameter settings.
Thread reuse saves CPU overhead to create/tear down.
Reduced CPU utilization is a benefit of thread reuse.
Information Management
Computer Consultant Company5
CICS Program Flow – Typical Mix Some w/DB2 / Some not
CICS programs ‘Go to’ any other CICS program
DB2 requires a DBRMCICS mainProgram
Tranid: ABCD
PgmANo DB2
PgmB DB2 SQL
PgmBBDB2 SQL
PgmCDB2 SQL
PgmDNo SQL
Information Management
Computer Consultant Company6
CICS Program Flow continued
Transaction ‘ABCD’ starts at Main CICS program.
Based on program options, from MAIN flows to PGMA, PGMB, PGMC or PGMD
– The CICS program does not need DB2.
– If DB2 is present, must have a DBRM
PGMB, PGMBB, and PGMC have DB2 content
– The BIND controls how the DBRM is identified
– Several options exist to find the DBRM
Information Management
Computer Consultant Company7
Review of CICS/DB2 Interface Options
CICS defines the DB2 Environment
CICS names the DB2 system
CICS defines the DB2 Interface
– Define TOTAL NUMBER OF DB2 THREADS
– Define How DB2 threads will be used
• By TRANID• By group of TRANIDs, etc.
– If a Thread will be PROTECTED
– If a Thread will be initialized at start up
– Duration of thread WAIT for reuse
Information Management
Computer Consultant Company8
Review of CICS/DB2 Options continued
Evaluate CICS/DB2 Interface options
– Thread define
– Protected Thread Allocation
– Threads at initialization
Evaluate DB2 BIND options
– Option 1 – The BIG Plan
– Option 2 – Dynamic Plan Selection
– Option 3 - Packages
Information Management
Computer Consultant Company9
Review CICS/DB2 Conventions
DB2 executes against a Thread
– The thread represents control blocks required to anchor DB2 activity
The DB2 UOW is managed by BIND variables
BIND ACQUIRE indicates when a thread is built
– At program initialization
– At first SQL use
BIND RELEASE indicates when a thread is available for teardown or reuse
– BIND DEALLOCATE – teardown thread when program is deallocated.
– BIND COMMIT – teardown thread when commit changes.
Information Management
Computer Consultant Company10
Review CICS/DB2 BIND options
The DB2 BIND options
– Option 1 - We can have ‘one BIG plan’ called ‘ABCD’ that all of the programs with DB2 are bound into….
– Option 2 - We can have separate plans for each program that has DB2 content, i.e. PGMB, PGMBB, and PGMC• The programs would use the DPS exit to load the proper DBRM• The program would do a sync point before issuing the CICS EXTL
or LINK to new program• The default exit would load the DBRM corresponding to the
program name
– Option 3 - We would bind each DB2 content program as a ‘package’. The 3 packages (PGMB, PGMBB, and PBMC) would be bound into a plan called ‘ABCD’.
Information Management
Computer Consultant Company11
Option 1 – The BIG Plan. Bind all DB2 programs into a PLAN Thread reuse
– One thread is acquired and used for the duration of the CICS TRANID execution.
Locking concurrency– Highest level of locking in any of the programs is propagated
for ALL programs using DB2.
– If a program is read only, but another UPDATES, the lock intent is UPDATE.
Plan change– To update any program, requires stopping ALL programs to do
the BIND and new copy ALL CICS programs.
– BIND requires re-binding ALL DBRMs used by ALL programs.
Information Management
Computer Consultant Company12
Option 2 – DPS (Dynamic Plan Selection) changes plan. Exit Drives new DBRM that matches program name
Thread Reuse
– No thread reuse.
– When execute SQL in program build thread. Sync Point drives exit leaving program forces thread tear down.
Locking Concurrency
– Lock granularity by program.
– Separate UOW for each program. Does not guarantee locks between program execution.
Plan Change
– Can individually change program/DBRM and re-BIND plan.
– Must Stop PROGRAM/PLAN to update.
Information Management
Computer Consultant Company13
Option 3 - Bind Package Benefits – Reduce Bind time
Before packages
– Program modification (with or without SQL change), required a BIND PLAN ACTION(REPLACE). This resulted in re-optimizing all DBRMs in the plan, even unmodified DBRMs. • This caused excessive resource and time consumption
• Undesired access path change for the unmodified DBRMs.
• Long outages during BIND
Solution Bind Package
- BIND PACKAGE allows a single DBRM to be optimized. If program changes, the package associated with it is the only package that needs to be rebound.
- None of the PLANS that contain this package need to be rebound.
Information Management
Computer Consultant Company14
DB2/CICS Interface – Define DB2 within CICS CICS defines DB2 Interface controlling DB2 thread management CEMT I
STATUS: ENTER ONE OF THE FOLLOWING OR HIT ENTER FOR DEFAULT
AUTInstmodel DSName JVMPool TCPIP
AUTOinstall DUmpds Line TCPIPService
AUXtrace ENQ MODename TDqueue
BEan ENQModel MONitor TErminal
BRfacility EXci Netname TRAnsaction
CFdtpool FEConnection PArtner TRDumpcode
CLasscache FENode PROCesstype TSModel
CONnection FEPOol PROFile TSPool
CORbaserver FEPRopset PROGram TSQueue
DB2Conn FETarget REquestmodel UOW
DB2Entry FIle RRms UOWDsnfail
DB2Tran Gtftrace STAtistics UOWLink
DEletshipped INttrace STReamname Vtam
Information Management
Computer Consultant Company15
DB2 Connection – How DB2/CICS Communicate
I DB2C
STATUS: RESULTS - OVERTYPE TO MODIFY
Accountrec( Txid ) Planexitname( )
Authid( ) Priority( High )
Authtype( Sign ) Purgecyclem( 00 )
Comauthid( ) Purgecycles( 30 )
Comauthtype( Csign ) Resyncmember( )
Comthreadlim( 0001 ) Signid( CICSDVLA )
Comthreads(0000) Security( )
Connecterror( Sqlcode ) Standbymode( Reconnect )
Connectst( Connected ) Statsqueue( CSSL )
Db2groupid( ) Tcblimit( 0047 )
Db2id( DSNW ) Tcbs(0000)
Db2release(0810) Threaderror(Abend)
Drollback(Rollback) Threadlimit( 0010 )
Msgqueue1( CSMT ) Threads(0000)
Msgqueue2( ) Threadwait( Twait )
Msgqueue3( )
Nontermrel( Norelease )
Plan( DEFAULT )
Information Management
Computer Consultant Company16
DB2 Connection continued
Authtype (Sign)– How the connection thread will identify to CICS/CICS transactions
DB2id(DSND)– Name of the DB2 subsystem this CICS will communicate with
DB2release(810)
Purgecyclem(00)– Purgecycles(30)– How often CICS will check for unused threads and tear down old threads.
Tcblimit(0047)– Total count of TCB attaches allowed for this CICS
Threadlimit(0010) – Total number of concurrent threads this CICS can talk to
Threads(0000)– Threadwait(Twait)– If a thread is unavailable, what should the requestor do, ie WAIT, TERMINATE
Information Management
Computer Consultant Company17
DB2 Entry statementIndicates DB2/CICS thread management
I DB2ENTRY
STATUS: RESULTS - OVERTYPE TO MODIFY
Db2e(ADDB ) Txi Sig Ena Poo Hig Pro( 0000 ) Pth(0000)
Threadl( 0000 ) Threads(0000) Tpo Plan( CCADDB25 )
Db2e(ADIN ) Txi Sig Ena Poo Hig Pro( 0000 ) Pth(0000)
Threadl( 0002 ) Threads(0000) Tpo Plan( ADIN )
Db2e(ADMT ) Txi Sig Ena Poo Hig Pro( 0000 ) Pth(0000)
Threadl( 0000 ) Threads(0000) Tpo Plan( ADMT )
Db2e(ADRB ) Txi Sig Ena Poo Hig Pro( 0000 ) Pth(0000)
Threadl( 0000 ) Threads(0000) Tpo Plan( ADRB )
Db2e(AMCS ) Txi Sig Ena Poo Hig Pro( 0001 ) Pth(0000)
Threadl( 0003 ) Threads(0000) Tpo Plan( DAMSE2 )
Information Management
Computer Consultant Company18
DB2 Entry statement - continued
Review elements of ENTRY statement
Db2e(ABCD) – pertains to CICS transaction, ABCD. It identifies the following:– Will use the CICS SIGNON to identify the user AUTHID.– It is ENABLED vs UNENABLED.– Runs as a POOL thread vs individual thread– Executes HIGH priority vs Medium or LOW.– Identified count of the presently executing threads.
Threadl(0003)
Threads(0000)
Tpo PLAN( DP003) plan name
Information Management
Computer Consultant Company19
DB2 Entry Statement – continuedDisplay of thread options
I DB2ENTRY
RESULT - OVERTYPE TO MODIFY
Db2entry(DPIN)
Accountrec( Txid )
Authtype( Sign )
Enablestatus( Enabled )
Disabledact( Pool )
Priority( High )
Protectnum( 0000 )
Pthreads(0000)
Threadlimit( 0002 )
Threads(0000)
Threadwait( Tpool )
Plan( APIN )
Planexitname( )
Authid( )
Drollback(Rollback) SYSID=DVLA APPLID=CICSDVLA
TIME: 10.11.41 DATE: 03.19.07
Information Management
Computer Consultant Company20
DB2 TRAN statement- Ties together CICS and DB2 information.
I DB2TRAN
STATUS: RESULTS - OVERTYPE TO MODIFY
Db2t(AADB ) Db2e( DADB ) Tra( DADB ) Plan(CdasDB25)
Db2t(APIN ) Db2e( DPIN ) Tra( DPIN ) Plan(DPIN )
Db2t(APMT ) Db2e( DPMT ) Tra( DPMT ) Plan(DPMT )
Db2t(APRB ) Db2e( DPRB ) Tra( DPRB ) Plan(DPRB )
Db2t(ASYN ) Db2e( DSYN ) Tra( DSYN ) Plan(DSYN )
Db2t(BMSP ) Db2e( BMPS ) Tra( BMSP ) Plan(BMPS )
Db2t(DGCS ) Db2e( DGCS ) Tra( WDOC ) Plan(CDMSE2 )
Db2t(DIAL ) Db2e( DIAL ) Tra( DIAL ) Plan(DIAL )
Db2t(DM01 ) Db2e( DT01 ) Tra( DT01,DT11 ) Plan(DT01 )
Information Management
Computer Consultant Company21
DB2 TRAN statement - continued
The TRAN statement identifies information to tie together CICS and DB2.
CICS transaction nameDb2t(DPIN )
DB2 entry thread name DB2e(DPIN )
DB2 PLAN that they will execute under. Plan(DPIN )
Information Management
Computer Consultant Company22
DB2 TRAN statement - continued
DB2 TRAN detail shows the following:
I DB2TRAN
RESULT - OVERTYPE TO MODIFY
Db2tran(DPIN)
Db2entry( DPIN )
Transid( DPIN )
Plan(DPIN)
Planexitname() plan exit other than DEFAULT MUST put name in Planexitname(xx) parm
Information Management
Computer Consultant Company23
Combining DB2 / CICS program requirements
CICS program compiled in load library
– This creates an executable object module with CICS code
DB2 requires a program with SQL be BOUND
– The BIND process creates a DB2 object module called a DBRM (Data Base Request Module)
– The DBRM h as the DB2 access path selection for going after the DB2 data requested in the SQL.
TO RUN, CICS object module / DB2 DBRM must MATCH
The PROCESS…..
Information Management
Computer Consultant Company24
Consistency Token used during package search
CT is embedded in modified source and DBRM at precompile time. It is propagated to the load module and package for integrity checking by DB2 at execution time.
The CT is a DB2 internal time stamp embedded to ensure package uniqueness to maintain the integrity of the executing load module and package.
Db2 Directory (SKPT01)
Packages
LOC1.COL1.PROGAV_ID
CT:1111
LOC1.COL1.PROGAV_ID
CT: 2222
Load Library
Load modules
PROGAV_ID: V1R1
CT: 1111
PROGAV_ID: V2R1
CT:2222
Information Management
Computer Consultant Company25
Binding packages
1. When PGMB is modified…
Action:BIND PACKAGE(COL1) MEMBER(PGMB) ACTION(REPLACE)
2. No need to bind PLAN1 and PLAN2
Packages can be used in more than one plan. To change PGMB, you BIND only that program/DBRM.
DBRMPGMA
DBRMPGMB
DBRMPGMC
PackageCOL1.PGMA
PLAN1
PackageCOL1.PGMB
PackageCOL1.PGMC
PLAN2
Information Management
Computer Consultant Company26
Using a PACKAGE LIST (PKLIST)
PLAN1- Bind only DBRMs BIND PLAN(PLAN1)
MEMBER(DBRMA,DBRMB)….
PLAN2 –Bound with both DBRMs
and packagesBIND PLAN(PLAN2)
MEMBER(DBRMA,DBRMB,DBRMC) PKLIST(COL.PACKA,COL.PACKB)…
PLAN3 – Bound only from packagesBIND PLAN(PLAN3)
PKLIST(COL.PACKB, COL.PACKC)…
One plan can include multiple DBRMs and multiple packages. One DBRM or one package can be included in multiple plans.
DBRMA
DBRMC
PLAN1
PLAN2
PLAN3
DBRMB
PACKA
PACKB
PACKC
Information Management
Computer Consultant Company27
Components of a Package Name
A package has a three-part name:Location_nameCollection_idPackage_id
Location_name.collection_id.package_id
DB2M.COL1.PROGA
DB2M.COL2.PROGB
PackagePROGA
PackagePROGB
COL1 COL2
PackagePROGB
BIND PACKAGE(COL1)
MEMBER(PROGA)
BIND PACKAGE(COL1)
MEMBER(PROGB)
BIND PACKAGE(COL2) MEMBER(PROGB)
Information Management
Computer Consultant Company28
Using an Asterisk in Package List (PKLIST)
Option: Meaning
•For Location_name
•(*.col1.pack1)
Location_name must be supplied at run time
CURRENT SERVER is set with:
SQL CONNECT statement in program
CURRENTSERVER option when bind plan
Default location DB2 loc name or blank if local DB2 has no location name
Information Management
Computer Consultant Company29
Using an Asterisk in PKLIST continued
Option: Meaning
•For collection_id
•(*.pack1)
Collection_id must be supplied at run time by:
CURRENT PACKAGESET special register
w/SET CURRENT PACKAGESET in program
DEFAULT IS BLANK
* For package_id (col1.*) All packages within specified collection are included
Information Management
Computer Consultant Company30
CICS / DB2 Verification of Thread Reuse
Evaluate Thread usage through
– Monitors
– CICS Shut down statistics– See DB2 stats:
> DB2 Connection> DB2 Entry> DB2 Performance
Information Management
Computer Consultant Company31
CICS / DB2 Shutdown Statistics DB2 CONNECTION STATISTICS
DB2 Connection Name . . . . . . . . . . . . : BB1P2
DB2 Sysid . . . . . . . . . . . . . . . . . : DB2W
TCB Limit . . . . . . . . . . . . . . . . . : 100
Peak number of tasks on the TCB Readyq. . . : 0
Pool Thread Plan name . . . . . . . . . . . :
Pool Thread Dynamic Planexit name . . . . . : DSNCUEXT
Pool Thread Authtype. . . . . . . . . . . . : USERID
Pool Thread Accountrec setting. . . . . . . : TXID
Pool Thread Threadwait setting. . . . . . . : YES
Pool Thread Priority. . . . . . . . . . . . : EQUAL
Total number of calls using Pool Threads. . : 8,455,563
Total number of Pool Thread Signons . . . . : 79,006
Total number of Pool Thread Partial Signons : 73,242
Total number of Pool Thread Commits . . . . : 10,085
Total number of Pool Thread Aborts. . . . . : 20
Total number of Pool Thread Single Phases . : 148,251
Total number of Pool Thread Reuses. . . . . : 0
Total number of Pool Thread Terminates. . . : 372,364
Total number of Pool Thread Waits . . . . . : 0
Pool Thread Limit . . . . . . . . . . . . . : 65
Peak number of Pool Threads in use. . . . . : 13
Peak number of Pool tasks . . . . . . . . . : 12
Total number of Pool tasks. . . . . . . . . : 113,156
Peak number of tasks on the Pool Readyq . . : 0
Command Thread Authtype . . . . . . . . . . : OPID
Total number of Command Thread Calls. . . . : 0
Total number of Command Thread Signons. . . : 0
Total number of Command Thread Terminates . : 0
Total number of Command Thread Overflows. . : 0
Command Thread Limit. . . . . . . . . . . . : 1
Peak number of Command Threads. . . . . . . : 0
Information Management
Computer Consultant Company32
CICS / DB2 Shutdown Statistics – DB2 ENTRY
DB2ENTRY STATISTICS - REQUESTS
DB2Entry Call Signon Partial Commit Abort Single Thread
Name Count Count Signon Count Count Phase Reuse
AADB 1 1 1 0 1 0 0
DYNAMIC 5088291 1637 84 0 0 213747 0
MCMHG000 45 5 3 0 0 5 0
MCMHH000 80 5 2 0 0 5 0
MCMHI000 11 2 0 0 0 6 0
MCMHP000 156 3 2 0 0 6 0
MCMHR000 69 3 0 0 0 4 0
MSSCC000 9631531 0 0 3341 1 5414 8724
MOSN 13364 119 109 36 0 198 0
NIPW 126M 0 0 0 0 3659034 3657871
*TOTALS* 142M 1775 201 3377 2 3881985 3670044
thread reuse
Information Management
Computer Consultant Company33
CICS / DB2 Shutdown Statistics – DB2 Performance
DB2ENTRY STATISTICS - PERFORMANCE
DB2Entry Thread Thread Pthread Pthread Task Task Readyq
Name Limit HWM Limit HWM HWM Total HWM
MCMHZ000 0 0 0 0 0 0 0
MSGBE000 10 3 5 3 3 1,588 0
MSSCC000 10 1 5 1 1 8,756 0
MSSCS000 0 0 0 0 0 0 0
MMSCY000 0 0 0 0 0 0 0
MOSN 0 0 0 0 1 234 0
NIPW 45 40 35 35 40 278,803 0
NSP1 0 0 0 0 0 0 0
*TOTALS* 502,578
See information on threads…
…limit, High Water Mark, Protected
Information Management
Computer Consultant Company34
References
IBM Redbook, “DB2 Packages: Implementation and Use”, GG24-4001-007083-00, October 1993
– http://publib-b.boulder.ibm.com/abstracts/gg244001.html
IBM ITSO San Jose Center, “CICS/ESA-DB2 Interface Guide”;
SG24-4536, September 1995
– http://publib-b.boulder.ibm.com/abstrcts/sg244536.html
“CICS/ESA System Programmer’s Guide” defines parms
– http://www-
Information Management
Computer Consultant Company
Summary – Performance Benefits using Packages
Patricia TownsendComputer Consultant [email protected]