Found 6702 Articles for Database

Implementation of a table level locks in a COBOL-DB2 program during program execution

Mandalika
Updated on 11-Sep-2020 12:34:54

1K+ Views

The COBOL-DB2 program can place the lock into a DB2 table in two ways.When the SQL statement using that table is executed within the program.When the program is loaded in the main memory and it is ready to be executed. It acquires a lock on all the DB2 tables which are used in the SQL statements within the program.To acquire the lock on all DB2 tables once the program is loaded in the main memory or allocated to a thread, we have to BIND the plan using appropriate options and parameters. Below is a JCL step which can be used.//BIND ... Read More

Implementation of a table level locks in a COBOL-DB2 program during SQL execution

Mandalika
Updated on 11-Sep-2020 12:30:31

698 Views

The locks in DB2 are acquired on table and tablespaces to avoid the issues arising due to LOST UPDATE, DIRTY READ and PHANTOM.We need to define the lock parameter during the BIND package/plan step using the ACQUIRE option.A COBOL-DB2 program PROGA is using SQL statements to access table TA. If we need to place a lock on the table only when that particular SQL statement is executed within the program, then we need to define the BIND JCL step as below−//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) - ... Read More

Steps involved in compilation of a COBOL-DB2 program

Mandalika
Updated on 11-Sep-2020 12:22:04

8K+ Views

To prepare a COBOL-DB2 program for execution, we have to go through certain steps. These steps include pre-compilation - compilation - binding - linkediting.The pre-compilation is done using the utility DSNHPC. In the pre-compilation step all the SQL statements which are present in the source program are replaced by corresponding COBOL calls. All the SQL statements are taken in an object known as database resource module (DBRM) and passed on to the BIND step. The modified source code is passed on to the compilation step.In the compilation step, the modified source is compiled and the object module is generated. The ... Read More

What is the execution result when non-SQL changes are made in a DB2 program without BIND?

Mandalika
Updated on 11-Sep-2020 12:15:33

238 Views

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 no SQL change) 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 then 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 ... Read More

What will be the result if there is a timestamp mismatch in the DBRM and Load module?

Mandalika
Updated on 01-Dec-2020 04:57:26

576 Views

When the COBOL-DB2 source code is given as an input in the pre-compilation stage, we get 2 important components — DBRM and modified source code.In modified source code, the SQL statements are replaced by COBOL calls and the DBRM contains all the SQL statements which are present in the COBOL-DB2 program. The pre-compiler inserts the timestamp in both DBRM and modified source code.In case of DBRM bind directly to the plan, the system compares the timestamp of the DBRM and load module when the COBOL-DB2 program is executed. In case there is a mismatch in the timestamp the JCL step ... Read More

What is the execution result when a DB2 program is compiled and bound on separate days?

Mandalika
Updated on 11-Sep-2020 12:12:19

116 Views

The program will run successfully (unless there are no logical errors in the program)because the timestamp is inserted in the DBRM during pre-compilation and pre-compilation is done before the compilation step. Therefore, the DBRM and the load module will have the same timestamp.The timestamp inserted in the DBRM is further passed to the package also. So in case, if we are using DBRM-package-plan combination, In that case also the program will run successfully as there is the consistency in the timestamp throughout.

When a DB2 subprogram undergoes changes, do we need to BIND it with its program?

Mandalika
Updated on 11-Sep-2020 12:07:32

629 Views

When any COBOL-DB2 program is pre-compiled, the current timestamp is inserted in the DBRM and if the DBRM is binded to a package then the timestamp is further copied to a package. Similarly, the timestamp is also inserted in the load module during the compilation process.When any COBOL-DB2 program is executed, the system matches the timestamp of the load module with that in the DBRM/package, if there is mismatch then the program fails.In case DBRM directly binds to a plan, we need to bind both the plans - PLANA and PLANB again even if only the subprogram has gone through ... Read More

How to BIND a DBRM into a PACKAGE and PACKAGE into a PLAN?

Mandalika
Updated on 11-Sep-2020 12:03:38

3K+ Views

A DBRM can be directly bound to a plan or we can first bind DBRM into a package and then bind that package into PLAN.In case DBRM binds to a plan directly, if there is some change in the source code, the new DBRM has to be generated and then we have to bind the entire plan again. Since, plan contains multiple DBRMs, the system will process all the DBRMs again in order to bind that plan (even if the other DBRMs have not gone through any changes). This process takes a lot of resources like memory, processor and valuable ... Read More

How to BIND a DBRM directly into a PLAN?

Mandalika
Updated on 11-Sep-2020 11:56:40

541 Views

A DBRM is a DB2 object which is generated from the pre-compilation of the source code. It contains all the SQL statements/queries of the source code. DBRM could not be executed directly due to its format, hence it is binded into a plan first. There can be multiple DBRM which can be binded in a single plan.Whenever there is a source code change, corresponding DBRM has to be generated again with changed SQL statements/queries. Then the entire plan (which contains the old DBRM) has to be bound again.Using the below JCL step we can BIND a DBRM directly into a ... Read More

How to precompile a COBOL-DB2 program?

Mandalika
Updated on 11-Sep-2020 11:49:13

3K+ Views

Precompilation is the process through which the SQL statements used in the COBOL-DB2 program are replaced by appropriate COBOL calls. The precompilation is necessary before the actual compilation because the COBOL compiler cannot recognize the DB2 SQL statements and will throw errors due to them.DB2 utility DSNHPC is used for the precompilation. The inputs to the precompilation JCL step are DCLGEN (in SYSLIB) for the respective tables which are used in COBOL-DB2 program and COBOL-DB2 source program (in SYSIN).//STEP010 EXEC PGM=IKJEFT01 //SYSIN DD DSN=DIS.TEST.COBOL(PSNEW2), DISP=SHR //SYSLIB DD DSN=DIS.TEST.DCLGEN(PSDC2), DISP=SHR //DBRMLIB DD DSN=DIS.TEST.DBRMLIB(PSNEW2), DISP=SHR //SYSCIN DD DSN=DIS.TEST.COBL(PSCOB2), DISP=(NEW, CATLG, DEL), SPACE=(20, ... Read More

Advertisements