Static SQL - COBOL PRE-COMPILE process

 

STEP 1 -  DB2 PRECOMPILE Process
The DB2 Precompile performs three functions:
1. It adds working storage areas and source code compatible statmens that are used to invoke DB2. (such as, INCLUDE, Precompiler will search the included memeber from pre-defined lib, then copy it to program when it is found.)
2. It checks the SQL in the program for errors, which use DCLGEN to check the SQL syntax. (Precomiler does't use DB2 sub-system and CATALOG in precompile stage)
3. Finally, all of the SQL statements are extracted from the program source and placed into a member called the DataBase Request Module, or DBRM, which also contains the consistency token.

STEP 2 - COMPILE
The modified source from the precompile is then compiled. The code is checked for errors, and a compiled version of the code is created.

STEP 3 - LINK-EDIT
The compiled code is link-edited along with statically called source language and DB2 run-time modules to create a Load Module. Imbedded in this module is the same consistency token that was generated in the precompile. If multiple DB2 programs are statically linked together, the resulting load module contains a consistency token for each one.

STEP 4 - DB2 BIND
The bind process reads the DBRM that was created in the precompile and prepares an access path to the data. This access path, along with the consistency token, is stored in the DB2 catalog as a Package. Every Package is bound into a Package List, or Collection. The name of the Collection is specified by the 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.


 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章