Problem: A COBOL-DB2 program is changed to increase the length of a variable from PIC X(5) to PIC X(8). However, there are no changes in the SQL of the program. What will be the result if the program's plan/package is not binded for these changes?
The variable length change from PIC X(5) to PIC X(8) is not a DB2 change and there are no modifications required for SQL statements in the program. However, still we need to BIND its PLAN/PACKAGE else we will get SQL error code -818 which states that “THE PRECOMPILER-GENERATED TIMESTAMP x IN THE LOAD MODULE IS DIFFERENT FROM THE BIND TIMESTAMP y BUILT FROM THE DBRM z”.
Following is the reason for this SQL error - In each execution of a COBOL-DB2 program, the timestamp of load module and package/DBRM are compared. If there is a change in the length of the variable (and there are no SQL changes) in the program and it is compiled, then the load module will have the newly generated timestamp and on the other hand if the BIND is not performed, the package/DBRM would have an old timestamp. When this program is executed, the JCL step calling this program will fail with SQL error code -818.
If we have a COBOL-DB2 program for which SQL statement is never going to change in the future, we can pre-compile this program with option LEVEL. Below is the sample of the BIND step using the LEVEL option.
//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) - LEVEL - ACQUIRE(ALLOCATE) - ISOLATION (RS) /*