Search

Wednesday, October 17, 2012

DB2 Bind process

DB2 Bind precompiler process

DB2 Bind Process  

Find a quick overview of the bind process in my earlier post.

                                         Process for Bind in Brief

PrecompilerFunctions:

Checks the DB2 code  in the program for errors. 
Adds working storage areas and source code compatible statements that are used to     invoke DB2. One to the working storage areas contains a literal "timestamp" called a consistency token.
Extracts all the SQL statement from the program source and placed into a member called   the DataBase Request Module, or DBRM, which has same consistency token.

Compiler:The COBOL code with SQL is input to complier and compiler checks for any error and Object Module is formed. This code is complied version of code.

Modified Code: 
The Object Module is input to Link-edit and modified code is linked to all the DB2 runtime components to create Load module or .exe file which is include in DB2COBOLprograms.
The 'timestamp' or consistency token is embed in this module which was generated in prec-ompiler stage. If there are more than one DB2 modules linked statically to load module then token  of each is generated and linked.

DB2 Bind:

  • Bind Process read DBRM which is created in precomplier stage and creates access path to read data.
  • Access path along with consistency token is stored in DB2 catalog tables as a package.
  • Every package is bound into package list or collection
  • Collection name is specified by package parameter.
  • A Collection is a group of Packages that are included in one or more Plans. The QUALIFIER parameter of the bind is used to direct the SQL to the specific set of DB2 objects (tables, views, aliases or synonyms) qualified by this name.
  • Apart from building plans and packages, bind also validates:
  1. SQL statements using DB2 Catalog
  2. Validates authorization id that if owner is allowed to perform bind process 
  3.  Selects access path depending upon availability of  indexes, table size etc. 

DB2-COBOL Program:

DB2 sub-system and plan name is given in JCL under SYSTSIN. 
When SQL statement is executed, DB2 searches for collection with the plan by package name and timestamp. This should match else it give bind error -805.

I have written DB2 bind as required in SCLM. The steps may vary for some other tools but the bind process remains same. 

No comments:

Post a Comment