Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1791810
  • 博文数量: 335
  • 博客积分: 4690
  • 博客等级: 上校
  • 技术积分: 4341
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-08 21:38
个人简介

无聊之人--除了技术,还是技术,你懂得

文章分类

全部博文(335)

文章存档

2016年(29)

2015年(18)

2014年(7)

2013年(86)

2012年(90)

2011年(105)

分类: DB2/Informix

2013-03-23 23:58:42

讲述了主机上source code的处理过程以及consistent token 作用
When the source code is ready, the first step is to precompile the program
with the DB2 precompiler. The DB2 precompiler generates two different
data sets: the modified source module and the Database Request Module
(DBRM). In the modified source module the EXEC SQL statements are
replaced by a call to the DB2 language interface. The DBRM contains all of
the EXEC SQL statements that were extracted from the source program.
Because one source program is separated into these two data sets, DB2
inserts a consistency token into both data sets to check at run time that the
two data sets originally came from the same source program. This
consistency token is passed to the load module from the modified source
module in the compiling and link-editing process.
bind成plan形式
The BIND process transforms the DBRM into DB2 interpretable form. The
output of BIND is called a plan. A consistency token is copied from the
DBRM to the plan at this point. At execution time, this consistency token is
checked against the consistency token of the load module.
 plan与program的关系:多对多,由此带来的问题就是程序一旦modify,相关的就要全部rebind,为了解决这个问题,引入了package
In the bind plan process, multiple DBRMs can be included in one plan.
Because one DBRM consists of one program, a plan can contain
information on SQL statements for multiple programs. When a program is a
common routine shared by multiple applications, one DBRM is bound into
multiple plans.
program1 ,common routine of program2 ,program3 
program1    -----------dbrm1 |           
                                       \
                                        plan1    
                                      /
program2    ------------dbrm2|       
                                       \
                                        plan2    
                                       /
program3    ------------dbrm3|
一旦其中的某个程序modify,真个plan就要重新rebind,而且多个program的bind的参数也要一致,这都是bind的disadvantage
为此引入了package:
Instead of binding a DBRM into a plan, one can bind it into a unit called a
package. The difference between binding a DBRM into a plan and into a
package is that a package is always bound from a single DBRM, whereas a
plan can be bound from multiple DBRMs.
也就是plan不仅可以单单从DBRM bind成,也可以从packagelist bind 而成、
Plans can still have one or more DBRMs directly bound into them.
However, with the implementation of packages, a plan can include, in
addition to the DBRMs, a list of packages called PKLIST (package list).
package的集合交collection:
The collection_id is a qualifier that denotes a logical grouping of packages.

Package_id
The package_id is a qualifier that is automatically generated from the name
of the DBRM input at bind package time. Thus, you could say that the
package_id can actually be specified as the DBRM name at precompile
time. Because the DBRM name is usually the same as the program name,
the package_id is equal to the program name in most cases. This makes
packages easier to manage than plans. Before the advent of packages, the
plan name was not always the same as the program name because, in
many cases, plans included multiple programs.
The version_id is set at precompile time by specifying the precompiler
option VERSION. When VERSION is not specified, the version_id will be an
empty string. It cannot be changed at bind time. In the precompilation
process, the version_id is embedded in both the load module and the
DBRM. When bound, a package inherits the version_id from the DBRM.

Consistency Token
Consistency tokens are used by DB2 during package search. They ensure
package uniqueness because DB2 maintains the integrity of the executing
load module and package by their consistency tokens.
The consistency token is embedded in the modified source module and the
DBRM at precompile time, and it is propagated to the load module and the
package for integrity checking by DB2 at execution time.

level & version   
The consistency token is a DB2 internal time stamp unless the LEVEL
keyword is used at precompile time. If you use the LEVEL keyword, the
consistency token becomes the value you specify in that keyword. Hence,
using the LEVEL keyword enables you to control changes in the consistency
token. (The words LEVEL and VERSION are sometimes confusing. LEVEL
is used to control the consistency token, whereas VERSION is used to keep
multiple instances of the same package name.)

CURRENT PACKAGESET
When selecting a package at program execution time, the value in the
CURRENT PACKAGESET special register is used as the collection_id for the
package being searched. PACKAGESET stands for collection_id.
Blank is the default value of the CURRENT PACKAGESET special register.
There is a major difference between a blank value and a set value in the
package search algorithm.
Package Benefits
1 减少了程序的bind是只有相关的程序需要rebind,而不是所有的程序
2 支持统一程序的不同版本(version_id)
Flexible Naming Conventions
Increased Bind Availability
Granularity in Bind Options
阅读(7470) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~