Accenture DB2 Interview Questions and Answers

11/16/2009 No Comment

Accenture DB2 Interview Questions and Answers.

DB2 Interview Questions and Answers asked in various companies 

Explain how would you retrieve rows from a DB2 table in embedded SQL?Answer : You can achieve it by either by using the single row SELECT statements, or by using the CURSOR

What are the alternate ways available to you to retrieve a row from a table in embedded SQL apart from cursor?
Answer : By using Single row SELECT.

Explain how can you specify and use a cursor in a COBOL program?
Answer : 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

Can you tell me what will happen when you say OPEN CURSOR?

Answer : 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.

Is it possible more than one cursor open at any one time in a program?
Answer : Yes, we can open more than one cursor at a time

Can you tell if DECLARE CURSOR is executable?

Answer : No, DECLARE CURSOR is not executable.

Explain in brief how do you leave the cursor open after issuing a COMMIT?

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

When you do a database COMMIT, is the cursor closed in DB2?
Answer : Yes, the cursor will be closed.

Describe the COBOL definition of a VARCHAR field
Answer : 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)

Can you tell me what is the physical storage length of each of the following DB2 data types:

Answer : 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)

Explain what are the contents of a DCLGEN in DB2?

Answer : 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.

In DB2, is it always mandatory to use DCLGEN? If not, why would you use it at all?

Answer : 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.

Is is always mandatory to use DECLARE TABLE in DCLGEN ? Can you tell why it used?

Answer : 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.

Explain in brief how is a typical DB2 batch Program gets executed ?

Answer : 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

List some fields from SQLCA.


Can you tell me how can you find out the # of rows updated after an update statement?

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

Can you tell what do you need to do before you do EXPLAIN?

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

Can you tell where is the output of EXPLAIN stored?

Answer : In userid PLAN_TABLE

What does it mean - EXPLAIN has output with MATCHCOLS = 0?

Answer : A non matching index scan if ACCESSTYPE = I

Explain how can you do the EXPLAIN of a dynamic SQL statement?

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

Explain what are the various isolation levels possible ?

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

Differentiate between CS and RR isolation levels?
Where do you specify them
Answer : CS: Releases the lock on a page after use RR: Retains all locks acquired till end of transaction. ISOLATION LEVEL is a parameter for the bind process

When do you specify the isolation level?

Answer : During the BIND process ISOLATION ( CS/RR )

Name the various locking levels available?


Explain in brief how does DB2 determine what lock-size to use?

Answer : 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

Explain what are the disadvantages of PAGE level lock in DB2?

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

No comments :


Aired | The content is copyrighted and may not be reproduced on other websites. | Copyright © 2009-2016 | All Rights Reserved 2016

Contact Us | About Us | Privacy Policy and Disclaimer