This chapterdiscussesprogrampreparationina CICSDB2environment: v “TheCICSDB2test environment”
v “CICSDB2programpreparationsteps”onpage 134
v “Whattobind aftera programchange” onpage137
v “Bindoptionsandconsiderationsfor programs”onpage138
v “CICSDB2programtestinganddebugging”onpage139
v “Goingintoproduction:checklistfor CICSDB2 applications”onpage139
v “TuningaCICSapplicationthataccessesDB2”onpage142
For informationonsupportfor Javaprograms andenterprisebeansintheCICS DB2 environment,seeChapter8,“UsingJDBCandSQLJ toaccessDB2datafrom Javaprogramsandenterprisebeanswritten forCICS,”onpage 117.
This chaptercontainsDiagnosis,ModificationorTuninginformation.
The
CICS
DB2
test
environment
You canconnectmorethanoneCICSsystemto thesameDB2system.However, theCICSDB2attachmentfacilitydoesnotallowyouto connectoneCICSsystem to morethanoneDB2system atatime.
You cansetupproductionandtestenvironmentswith: v AsingleCICSsystemconnectedto oneDB2system
v Twoor moreCICSsystemsfor productionandtest,connectedtothesameDB2
system v
Twoor moreCICSsystems,asabove,connectedto twoormoredifferentDB2
systems
Thefirstalternative,usinga singleCICSsystem forbothproductionandtest,isnot recommended.In releasesof CICSbefore CICSTransactionServerforOS/390, Version1 Release2,thiswasnotrecommendedbecausetheRCTcouldnotbe dynamically changed.Youcannow changetheCICSDB2definitions usingRDO without stoppingtheattachmentfacility.Programs,transactions,maps,terminals andDB2definitions canallbedynamicallyaddedto arunningsystem.However, this environmentisstillnotrecommended,becauseapplicationsintestcouldaffect theperformanceof theproductionsystem.
Thesecondalternative, withjustoneDB2 system,couldbeused forbothtest and production.Whetheritissuitabledependsonthedevelopmentandproduction environmentsinvolved.RunningatestCICSsystem andaproductionCICSsystem separatelyallowstestfailureswithout impactingproduction.
Thethirdalternative,with,for example,onetestandoneproductionDB2system,is themost flexible.Two CICSsubsystemscanrunwithoneormoreDB2systems. WheretheCICSsystemsareattached todifferentDB2systems:
v Userdata andtheDB2catalog arenotshared.Thisisanadvantageif youwant
toseparate testdatafromproductiondata.
v Wrongdesignorprogramerrorsintestedapplicationsdonotaffectthe
v Authorizationwithinthetestsystem canbelessstrictbecauseproductiondatais
notavailable.WhentwoCICSsystemsareconnected tothesameDB2system, authorizationmustbestrictlycontrolled,bothintermsof thefunctionsandthe datathatareavailabletoprogrammers.
CICS
DB2
program
preparation
steps
ThestepsshowninFigure33summarizehow toprepareyourprogramfor execution afteryour applicationprogramdesignandcodingiscomplete.
For anoverviewofthestagesinthisprocess,see“Preparinga CICSapplication programthataccessesDB2” onpage11.
When youprepareCICSapplicationprograms thataccessDB2:
v TheDB2precompiler(Step1)buildsaDBRMthatcontainsinformationabout
eachof theprogram’sSQLstatements. Italso validatesSQLstatementsinthe program.Formoreinformationabout usingtheDB2precompiler,seetheDB2 UniversalDatabasefor OS/390andz/OSApplicationProgrammingandSQL Guide.
USER JCL AND SUBMIT TO BATCH OR
DB2I
(1) DB2 PRECOMPILER DBRM
(2) CICS COMMAND LANGUAGE TRANSLATOR
(3) COMPILE OR ASSEMBLE PROGRAM
(4) LINK EDIT WITH INTERFACES (5) BIND
APPLICATION LOAD MODULE PLAN
v IfthesourceprogramiswritteninPL/I,theinputto Step1, theDB2precompiler,
istheoutputfromthePL/Imacrophase(ifused).
v YoucanrunStep1,theDB2precompiler,andStep2, theCICScommand
languagetranslator,ineithersequence.Thesequenceshownisthepreferred method,anditisthemethodsupportedbytheDB2Iprogrampreparationpanels. IfyouruntheCICScommandlanguagetranslatorfirst,it producesa warning messageforeachEXECSQLstatementit encounters,butthesemessages have noeffect ontheresult.
v
Ifyouuseoneof theLanguageEnvironment-conformingcompilers(COBOLand
PL/I)thathas integratedtheCICStranslator,translationof theEXECCICS commands(Step2)takesplaceduringprogramcompilation(Step3). Seethe CICSApplicationProgrammingGuideformoreinformation ontheintegrated CICStranslatorandthecompilersthatsupportit.
v IfyouarerunningDB2Version7orlaterandpreparing aCOBOLorPL/I
programusingoneof theLanguageEnvironment-conformingCOBOLorPL/I compilers,thecompileralso providesanSQLstatementcoprocessor(which producesa DBRM),soyoudonotneedto usetheseparateDB2precompiler (Step1).SeetheDB2 UniversalDatabaseforOS/390andz/OSApplication ProgrammingandSQLGuidefor moreinformationonusingtheSQLstatement coprocessor.
v IfyouarerunningDB2Version6orearlierandpreparingaCOBOLor PL/I
program,usetheseparateDB2precompiler.For aCOBOLprogram,ensurethat youspecifyastringdelimiterthatisthesamefor theDB2precompiler andthe integratedCICStranslator.Thedefaultdelimitersarenotcompatible.
v Inthelink editoftheprogram(Step4), includeboththeappropriateCICSEXEC
interfacemodule,or stub,for thelanguageinwhichyouarecoding,andthe CICSDB2languageinterface moduleDSNCLI.TheCICSEXECinterface modulemustbeincludedfirstintheloadmodule. (Formoreinformationonthe CICSEXECinterface modules,see theCICSApplicationProgrammingGuide.) Youcanlink DSNCLIwithyourprogramineither24-bitor 31-bitaddressing mode(AMODE=31). Ifyourapplicationprogramrunsin31-bitaddressing mode, youshouldlink-edittheDSNCLIstub toyourapplicationwiththeattributes AMODE=31andRMODE=ANYsothatyourapplicationcanrunabove16MB. v
Thebindprocess(Step5)requiresDB2.Thebindprocess usestheDBRMto
produceanapplicationplan(often justcalledaplan) whichenablestheprogram toaccessDB2data.See“Thebindprocess”onpage12formoreinformationon thebindprocess.Notethatagroup oftransactionsusingthesameentrythread (inother words,specifiedinthesameDB2ENTRY)must usethesame
applicationplan. TheirDBRMsmust beboundintothesameapplicationplan,or boundinto packagesthatarethenlistedinthesameapplicationplan.
Table9 showsthetasksthatyouneedto performto prepareaCICSDB2program, dependingonthelanguageof theprogramandonyourversionof DB2:
Table9.TaskstoprepareaCICSprogramthataccessesDB2 DB2version andprogram language Step1 (SQL statement processing) Step2(CICS command translation) Step3 (Program compile) Step4 (Link-edit) Step5 (Bind) DB2V6and Assembler DB2 precompiler CICS-supplied separate translator Language compiler Link-editwith EXECinterface andDSNCLI Bind process
Table9.TaskstoprepareaCICSprogramthataccessesDB2 (continued) DB2version andprogram language Step1 (SQL statement processing) Step2(CICS command translation) Step3 (Program compile) Step4 (Link-edit) Step5 (Bind) DB2V6andPL/I DB2 precompiler
Languagecompilerthat supportsintegratedCICS translator Link-editwith EXECinterface andDSNCLI Bind process DB2V6and COBOL DB2 precompiler
Languagecompilerthat supportsintegratedCICS translator Link-editwith EXECinterface andDSNCLI Bind process DB2V6and otherlanguages DB2 precompiler CICS-supplied separate translator Language compiler Link-editwith EXECinterface andDSNCLI Bind process DB2V7orV8 andAssembler DB2 precompiler CICS-supplied separate translator Language compiler Link-editwith EXECinterface andDSNCLI Bind process DB2V7orV8 andPL/I
Languagecompilerthatsupportsintegrated CICStranslatorandSQLstatement coprocessor Link-editwith EXECinterface andDSNCLI Bind process DB2V7orV8 andCOBOL
Languagecompilerthatsupportsintegrated CICStranslatorandSQLstatement coprocessor Link-editwith EXECinterface andDSNCLI Bind process DB2V7orV8 andother languages DB2 precompiler CICS-supplied separate translator Language compiler Link-editwith EXECinterface andDSNCLI Bind process
You canperformthis programpreparationusingtheDB2InteractiveInterface (DB2I) orbysubmittingyourownJCLforbatchexecution.
v DB2InteractiveInterface(DB2I): DB2Iprovidespanels toprecompile,compileor
assemble,andlink-editanapplicationprogramandto bindtheplan.For details aboutapplicationprogrampreparation,see theDB2Universal Databasefor OS/390andz/OSApplicationProgrammingandSQLGuide.
v UserJCLsubmittedto batchexecution: MembersDSNTEJ5CandDSNTEJ5Pin
theDB2library,SDSNSAMP,containsamplesoftheJCLrequiredtoprepare COBOLandPL/Iprogramsfor CICS.
If youperformthis processwhileCICSisrunning,youmayneedto issueaCEMT NEWCOPY commandto makethenewversion oftheprogramknowntoCICS.
CICS
SQLCA
formatting
routine
DSNTIAR,theIBM-suppliedSQLCODE messageformattingprocedure,lets you send asortof "SQLmessagesonline" toyourapplication.
WithDB2Version3 Release1,DSNTIARwassplitintotwofront-endmodules (DSNTIACandDSNTIAR)andarun-timemodule(DSNTIA1).DSNTIACisusedfor CICSapplicationsandDSNTIARforotherDB2interfaces.Thischange removed theneed, previousto DB23.1,torelink-edityourapplicationmoduleseverytimea change ismade toDSNTIAR,eitherbychangeof releaseorbyapplying
maintenance.If youhaveapplicationsthathave previouslybeenlink-editedwith DSNTIAR,youshouldconsiderlink-editingthemagainusingDSNTIACinstead, which willprovide performanceimprovmentsandisolatethem fromchangesto
TheCICSfront-endpart,DSNTIAC,issuppliedasasourcememberintheDB2 librarySDSNSAMP.
Thenecessaryprogramdefinitionsfor DSNTIACandDSNTIA1areprovided inIBM suppliedgroupDFHDB2ontheCSD.Youmust addtheSDSNLOADlibrarytothe CICSDFHRPLconcatenation (aftertheCICSlibraries)sothatDSNTIA1canbe loaded.
What
to
bind
after
a
program
change
For anoverview ofthebindprocess,see“Thebind process”onpage12.Foran overviewof plansandpackages,see“Plans,packagesanddynamicplanexits”on page 13.
TheexampleinFigure34showsaCICStransactionconsistingoffourprogram modules.Itisnotunusualthatthenumberofmodulesishighinarealtransaction. This sectiondescribeswhatyoumustdoifonemoduleischanged.
Assumingthatat leastoneSQLstatementchanged inprogramC,youmust performthefollowingstepstopreparetheprogramandto makethetransaction executable again:
1. PrecompiletheprogramonDB2.
2. TranslatetheprogramusingtheCICStranslator.
3. Compilethehostlanguagesourcestatements.
4. Link-edit.
5. If theDBRMforprogramCwas boundinto apackage,bindthatpackage
usingthenewDBRM, andalltheapplicationplansthatuse programCwill automatically locatethenew package.
6. If theDBRMforprogramCwas bounddirectlyinto anyapplicationplans,
locatealltheapplicationplansthatinclude theDBRMfor programC.Bindall theapplicationplansagain,usingtheDBRMsfor alltheprograms directly boundintothem,to getnewapplicationplans.Fortheprogramsthatwerenot changed,usetheiroldDBRMs.NotethatyoucannotusetheREBIND
subcommand,becauseinputto REBINDistheplanandnottheDBRMs. If youhavenotusedpackages before,notethatusingpackagessimplifiesthe rebindingprocess.Youcan bindeachseparate DBRMasa packageandinclude them ina packagelist.ThepackagelistcanbeincludedinaPLAN.You canthen use theBINDPACKAGEcommandtobind theDBRMsfor anychangedprograms,
Module A
Module B Module C
Module D
instead ofusingtheBINDPLAN commandto bindthewholeapplicationplan. This providesincreasedtransactionavailabilityandbetterperformance.Seesection “Using packages”onpage 90for moreinformationonusingpackages.
Bind
options
and
considerations
for
programs
See“Thebindprocess”onpage12foranoverviewof thebind process.
When bindingmultipleprograms intoanapplicationplan,beawareofthewayin which DB2usestime stamps.Foreach program,theDB2precompiler:
v Createsa DBRMwitha timestampofTdx (forexampleTd1for thefirstprogram,
Td2forthesecondprogram,andsoon).
v Createsa modifiedsourceprogramwitha timestampofTsxintheSQL
parameterlist(for exampleTs1andTs2,if twoprogramsareinvolved). At bindtime,theDBRMfor eachprogramisboundintothepackageorplanthat you havespecified.In addition,DB2updates itscatalogtableSYSIBM.SYSDBRM withonelinefor eachDBRM,togetherwithitstimestamp.Atexecutiontime, DB2 checksthetimestampsfor eachSQLstatement,andreturnsa-818SQLcodeif thetime stampfor theDBRM andthetime stampit hasplacedinthesource programaredifferent(inourexample,ifTd1andTs1aredifferent,orTd2andTs2 aredifferent).Toavoid-818SQLcodes,useoneofthefollowingstrategies: v Bindallprogramsintopackages,andlist thesepackagesintheapplicationplan.
Whenaprogramchanges,simplyprecompile,compile,andlink-edittheprogram, andbindit intoapackageagain.
v Ifyoubind anyprogramsdirectlyintoapplicationplans,ensurethatforeverynew
orchanged program,you precompile,compile,andlink-edittheprogram,then bindalltheapplicationplansthatinvolvethatprogram,usingtheDBRMsfromall theprogramsdirectlyboundintothoseplans.UsetheBINDcommand,notthe REBINDcommand,to dothis.
When youbindaplan, anumberofoptionsareavailable.Almostallbindoptions areapplicationdependentandshouldbetakenintoaccountduringtheapplication design.You shoulddevelopprocedurestohandledifferentBINDoptionsfor different plans.Also,theproceduresshould beableto handlechangesinBINDoptionsfor thesameplanovertime.
Thefollowingsectionsdescribesomespecificrecommendationsfor BINDoptions withCICS:
RETAIN
RETAIN® meansthatBINDandEXECUTEauthoritiesfromtheoldplan arenot changed.
When theRETAINoptionisnotused,allauthoritiesfromearlierGRANTs are REVOKED. TheuserexecutingtheBINDcommandbecomesthecreatorofthe plan, andallauthoritiesmustbereestablishedbynewGRANTcommands. This iswhyit isrecommendedthatyouusetheRETAINoptionwhenbindingyour plansintheCICSenvironment.
Isolation
level
It isrecommendedthatyouuseCursorStability (CS)unless thereisa specificneed for usingRepeatableRead(RR).This isrecommendedto allowahighlevelof concurrencyandtoreducetheriskof deadlocks.
Notethattheisolationlevelisspecifiedfor thecompleteplan.This meansthatif RRisnecessaryfora specificmoduleinCICS,thenalltheDBRMsincludedinthe plan mustalso useRR.
Also, iffor performancereasonsyoudecidetogroup anumberofinfrequently used transactionstogethertouse thesameDB2ENTRYandletthemusea common plan, thenthisnew planmustalso useRR,ifjustoneof thetransactionsrequires RR.
Plan
validation
time
AplanisboundwithVALIDATE(RUN)or VALIDATE(BIND).VALIDATE(RUN)is used todeterminehowto processSQLstatementsthatcannotbebound. If astatementmustbeboundat executiontime,it isreboundfor eachexecution. This meansthatthestatementisreboundforeverynewunitof work(UOW). Bindinga statementat executiontimecanaffect performance.Astatementboundat executiontime isreboundfor eachexecution.Thatis,thestatementmustbe reboundaftereach syncpoint.Itisnotrecommendedthatyouusethisoptionwith CICS.
NotethatusingdynamicSQLdoesnotrequireVALIDATE(RUN).Nevertheless, dynamicSQLimpliesthatastatementisboundat execution.
You shoulduseVALIDATE(BIND)ina CICSDB2environment.
ACQUIRE
and
RELEASE
Thegeneralrecommendationsfortheseparametersaredescribedin“Selecting BINDoptionsfor optimumperformance”onpage62.Theparameterschangefrom plan toplanandovertime, becausethey arerelatedto thetransaction rate.
CICS
DB2
program
testing
and
debugging
Thetoolsthatcanbeused intestinganddebugginga CICSapplicationprogram thataccesses DB2arethosenormallyusedinaCICSenvironment.Theseinclude: v Theexecutiondiagnosticfacility(EDF)
v TheCICSauxiliarytrace
v Transactiondumps.
For informationabouttheseandotherproblemdeterminationprocesses,see Chapter11,“ProblemdeterminationforCICSDB2,”onpage177.
Going
into
production:
checklist
for
CICS
DB2
applications
This checklistshowsthetasksyouneed toperformafterdesigning, developing,and testing anapplication,inorderto puttheapplicationintoproduction.
Thesetasksarehighlydependentonthestandardsyou haveusedinthetest system.Forexample,thetaskstobeperformedaredifferentif:
v OnlyoneDB2isused forbothtest andproduction.
Thefollowingdiscussionassumesthatyouuseseparate DB2andCICS subsystemsfor testandproduction.
Goingintoproductionimpliesperformingthefollowingactivities: Use DDLtoprepareproduction databases
AllDDLoperationsmust runontheproductionDB2system,usingDDL statements fromthetestsystem asabase.Some modificationsare probably needed,forexample,increasingtheprimaryandsecondary allocations,aswellasdefiningothervolumeserialnumbersanddefining a new VCATintheCREATESTOGROUPstatements.
Migrate DCLGEN
For COBOLandPL/Iprograms, youmayhaveto runDCLGEN operations ontheproductionDB2system,usingDCLGENinput fromthetestDB2 system.
Depending ontheoptiontakenfor compilations(if nocompilationsarerun ontheproductionsystem),analternativecouldbeto copytheDCLGEN outputstructuresfromthetestlibraries intotheproductionlibraries.This keepsallinformationseparatebetweentestandproductionsystems. Precompileforthe productionsystem
If youhaveboundyourprogramsintopackagesonthetestsystem,youdo