Bind options and considerations for programs

When binding multiple programs into an application plan, be aware of the way in which Db2® uses time stamps.

For each program, the Db2 precompiler creates the following:
  • The Db2 precompiler creates a DBRM with a time stamp of Td x. For example, Td1 for the first program, Td2 for the second program, and so on.
  • The Db2 precompiler creates a modified source program with a time stamp of Ts x in the SQL parameter list. For example, Ts1 and Ts2, if two programs are involved.
At bind time, the DBRM for each program is bound into the package or plan that you have specified. In addition, Db2 updates its catalog table SYSIBM.SYSDBRM with one line for each DBRM, together with its time stamp. At execution time, Db2 checks the time stamps for each SQL statement, and returns a -818 SQL code if the time stamp for the DBRM and the time stamp it has placed in the source program are different (in our example, if Td1 and Ts1 are different, or Td2 and Ts2 are different). To avoid -818 SQL codes, use one of the following strategies:
  • Bind all programs into packages, and list these packages in the application plan. When a program changes, precompile, compile, and link-edit the program, and bind it into a package again.
  • If you bind any programs directly into application plans, ensure that for every new or changed program, you precompile, compile, and link-edit the program, then bind all the application plans that involve that program, using the DBRMs from all the programs directly bound into those plans. Use the BIND command, not the REBIND command, to do this.

When you bind a plan, a number of options are available. Almost all bind options are application dependent and should be taken into account during the application design. You should develop procedures to handle different BIND options for different plans. Also, the procedures should be able to handle changes in BIND options for the same plan over time.

The following sections describe some specific recommendations for BIND options with CICS®.