PlansPkgsColls
合集下载
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
===>
===>
(Blank for member selection list) (DSN, TSN, or BSN) (BATCH, CICS, or TSO) (TEST, INTERIM, ALT, SASI, or PROD) (Package Collection ID) (S to Select Component)
Staff Development Session 2003.05
DB2 BIND PACKAGE ===> QUALIFIER(SSASIDB1)
Staff Development Session 2003.05
7 04/02/2003
Using Collection ID to run against Multiple Databases (cont.)
DSNT254I # DSNTBCM2 BIND OPTIONS FOR PACKAGE = CCSDTSN.CS1020BA.SAMPLE4.() ACTION REPLACE OWNER PJO QUALIFIER SSASIDB1 VALIDATE BIND EXPLAIN NO ISOLATION CS RELEASE COPY
6 04/02/2003
Staff Development Session 2003.05
Using Collection ID to run against Multiple Databases
By specifying a different collection identifier for a package, the same DBRM can be bound into different packages, enabling easy access to tables with the same structure but different qualifiers. For example, say you have two databases with the same tables but different qualifiers: SSASIDB1 and SSASINYR. And say it would be convenient to access both databases with the same program.
What does this meanFra Baidu bibliotekto me?
A program must be compiled into the correct collection.
COMMAND ===> ISPF LIBRARY: PROJECT ===> PDFLIB GROUP ===> PJO ===> TYPE ===> COBOL MEMBER ===> S2530016 DB2 SUB-SYSTEM ===> TSN TARGET SYSTEM ===> BATCH LOADLIB QUALIFER ===> TEST PKG. COLLECTION ID => CS2530BA COMPONENT SELECTION: DB2 PRE-COMPILER ===> S CICS TRANSLATOR ===> LINKAGE EDITOR ===> S DB2 BIND PACKAGE ===> S COMPONENT OPTIONS: VS COBOL II DB2 PRE-COMPILER CICS TRANSLATOR LINKAGE EDITOR DB2 BIND PACKAGE
What is a Package?
A single, bound DBRM with optimized access paths. By using packages the access logic is packaged at a lower level of granularity. The package name is added to the package list of a plan, so the package may be executed when the plan is executed. Benefits of using packages:
(NOT A PLAN)
(Options to APPEND or OVERIDE defaults) ===> LIST ===> DEC(15),SOURCE ===> ===> ===>
When you are assigned a new program numbering scheme, such as S3025xxx, you will have a new plan and new collection id. The plan must be granted authority in DB2 before it can be executed in DSN.
Staff Development Session 2003.05 5 04/02/2003
What is a Collection?
An identifier specified for each package used to group the packages into logical groups, or collections. It is not a physical DB2 object. Packages are included in plans according to their collection ids. For each of our systems at CCSD we have a collection for batch and a collection for online. We also have a batch and online collection for all subroutines. The subroutine collections are bound into all plans so subroutines can be shared across systems. For example:
Include both collections in the plan The program then specifies which collection to use, via the SET CURRENT PACKAGESET statement:
EXEC SQL SET CURRENT PACKAGESET = :HOST-VAR END-EXEC.
– Write the program, using unqualified embedded SQL – Bind the program twice. Once into a collection id like CSASI, with SSASIDB1 specified as the qualifier. Once into a collection id like CNEWYR, with SSASINYR specified as the qualifier.
Staff Development Session 2003.05
2 04/02/2003
What is a DBRM?
A module containing SQL statements extracted from a source program by the DB2 precompiler It is stored as a member of a partitioned data set. When a DBRM is bound into a plan, all its SQL statements are placed into the SYSIBM.SYSSTMT catalog table. When a DBRM is bound into a package, they are placed in the SYSIBM.SYSPACKSTMT table.
– DB2 catalog tables are consulted to determine the best access path – Information about the plan is then stored in other DB2 catalog tables – The executable plan itself is stored in the DB2 Directory
Staff Development Session 2003.05 3 04/02/2003
What is a Plan?
An executable module containing the access path logic produced by the DB2 optimizer. It can contain one or more DBRMs and/or packages. A plan is created by the BIND command.
Plans, Packages and Collections
Pam Odden
Staff Development Session 2003.05
1 04/02/2003
Objectives What is a DBRM? What is a plan? What is a package? What is a collection? Program preparation guidelines
– – – – CM6011BA = Batch collection for Payroll programs CSUBRTNB = Batch subroutines CPAYROL1 = Online collection for Payroll programs CSUBRTNO = Online subroutines
– If a program changes, only that program’s DBRM needs to be rebound. Without packages, the whole plan needs to be rebound at every change – Bind parameters, such as isolation level, can be specified at the package level. – Packages can be versioned, and multiple versions can exist in the DB2 catalog at the same time. By running the appropriate load module, DB2 knows which package to execute. – If you are using DB2 remotely, you can specify the location at which to bind the package.
In earlier versions of DB2, DBRMs were bound directly into plans. The concept of a package was added later.
4 04/02/2003
Staff Development Session 2003.05
The desired collection id, either CSASI or CNEWYR in our example, is passed to the program via a parameter.
Staff Development Session 2003.05
8 04/02/2003