300+ [MOSK ASKED] Accenture Db2 Interview Questions and Answers

1. Name The Various Locking Levels Available?

PAGE, TABLE, TABLESPACE

2. Explain What Are The Various Isolation Levels Possible ?

The isolation levels are CS: Cursor Stability RR: Repeatable Read

3. Explain How Can You Do The Explain Of A Dynamic Sql Statement?

  1.  Use SPUFI or MF to EXPLAIN the dynamic SQL statement
  2.  Include EXPLAIN command in the embedded dynamic SQL statements

4. Can You Tell Where Is The Output Of Explain Stored?

In user id PLAN_TABLE

5. Explain In Brief How Do You Leave The Cursor Open After Issuing A Commit?

Use WITH HOLD option in DECLARE CURSOR statement, it has not effect in psuedo-conversational CICS programs.

6. Can You Tell Me How Can You Find Out The # Of Rows Updated After An Update Statement?

You need to check the value stored in SQLERRD(3)

7. When You Do A Database Commit, Is The Cursor Closed In Db2?

Yes, the cursor will be closed.

8. Explain What Are The Contents Of A Dclgen In Db2?

EXEC SQL DECLARE TABLE statement which gives the layout of the table/view in terms of DB2 datatypes. A host language copy book that gives the host variable definitions for the column Names.

9. Differentiate Between Cs And Rr Isolation Levels?where Do You Specify Them?

CS: Releases the lock on a page after use

RR: Retains all locks acquired till end of traction. ISOLATION LEVEL is a parameter for the bind process

10. Describe The Cobol Definition Of A Varchar Field?

A VARCHAR column REMARKS would be defined as follows: 10 REMARKS 49 REMARKS-LEN PIC S9(4) USAGE COMP 49 REMARKS-TEXT PIC X(1920)

11. Can You Tell What Do You Need To Do Before You Do Explain?

You have to ensure that the PLAN_TABLE is created under the AUTHID

12. Explain How Can You Specify And Use A Cursor In A Cobol Program?

Try to use DECLARE CURSOR statement either in working storage or in procedure division, to specify the SELECT statement Then use OPEN, FETCH rows in a loop and finally CLOSE.

13. What Does It Mean – Explain Has Output With Matchcols = 0?

A non matching index scan if ACCESSTYPE = I 

14. Explain What Are The Disadvantages Of Page Level Lock In Db2?

The main disadvantage is the high resource utilization if large updates are to be done.

15. Explain In Brief How Is A Typical Db2 Batch Program Gets Executed ?

You should Use DSN utility to run a DB2 batch program from native TSO An example is shown: DSN SYSTEM(DSP3) RUN PROGRAM(EDD470BD) PLAN(EDD470BD) LIB(‘ED01TOBJLOADLIB’) END Use IKJEFT01 utility program to run the above DSN command in a JCL

16. Explain How Would You Retrieve Rows From A Db2 Table In Embedded Sql?

can achieve it by either by using the single row SELECT statements, or by using the CURSOR

17. Can You Tell If Declare Cursor Is Executable?

No, DECLARE CURSOR is not executable.

18. In Db2, Is It Always Mandatory To Use Dclgen? If Not, Why Would You Use It At All?

It is not always mandatory to use DCLGEN Using DCLGEN, helps detect wrongly spelt column names etc during the pre- compile stage itself ( because of the DECLARE TABLE ) DCLGEN being a tool, would generate accurate host variable definitions for the table reducing chances of error.

19. What Are The Alternate Ways Available To You To Retrieve A Row From A Table In Embedded Sql Apart From Cursor?

By using Single row SELECT.

20. Is It Possible More Than One Cursor Open At Any One Time In A Program?

Yes, we can open more than one cursor at a time

21. List Some Fields From Sqlca.?

SQLCODE, SQLERRM, SQLERRD

22. Explain In Brief How Does Db2 Determine What Lock-size To Use?

  1. Based on the lock-size given while creating the tablespace
  2. Programmer can direct the DB2 what lock-size to use
  3. If lock-size ANY is specified, DB2 usually choses a lock-size of PAGE

23. Is Is Always Mandatory To Use Declare Table In Dclgen ? Can You Tell Why It Used?

It not mandatory to have DECLARE TABLE statement in DCLGEN This is used by the pre-compiler to validate the table-name, view-name, column name etc, during pre-compile.

24. When Do You Specify The Isolation Level?

During the BIND process ISOLATION ( CS/RR )

25. Can You Tell Me What Will Happen When You Say Open Cursor?

If there is an ORDER BY clause, rows are fetched, sorted and made available for the FETCH statement Other wise simply the cursor is placed on the first row.

26. Can You Tell Me What Is The Physical Storage Length Of Each Of The Following Db2 Data Types:

DATE, TIME, TIMESTAMP and its picture clause in COBOL. DATE: 4bytes DATE: PIC X(10) TIME: 3bytes TIME PIC X(08) TIMESTAMP: 10bytes TIMESTAMP: PIC X(26)