How to bind multiple versions of a DB2 program into a package?


Packages are DB2 database objects which hold the executable forms of SQLs which are used in COBOL-DB2 programs. The packages are stored in a catalog table and contain the strategy/tables/columns/predicate associated with the SQL statements.

If there is a DB2 table ORDERS_TEST in test environment and ORDERS_PROD in production environment, then we need two versions of COBOL-DB2 program (which will access these tables) — one for test and the other for production.

Although both programs will be carbon copy of each other, the only difference lies in the SQL statements. The test version of the program will use table ORDERS_TEST in SQL statements and the production version of program will use ORDERS_PROD table in SQL statement. In order to achieve this versioning, we need to bifurcate the packages of the program.

To keep the multiple versions of the package, we have to use the VERSION option in the pre-compilation step. Therefore, we can give the VERSION(TEST) for the test version of the package and VERSION(PROD) for the production version of the package.

Following is an example:

Example

//BIND EXEC PGM=IKJEFT01
//STEPLIB DD DSN=DIS.TEST.LOADLIB,DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(TB3)
BIND PLAN(PLANA) -
PKLIST(PACKA) -
VERSION(PROD) -
ACQUIRE(ALLOCATE) -
ISOLATION (RS)
/*

Updated on: 01-Dec-2020

480 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements