Subscribe Jobs Via E-Mail


Latest top 50 Mainframe DB2 Interview Questions with Answers 2014

Latest Mainframe DB2 Interview Questions with Answers
Latest Mainframe DB2 Interview Questions with Answers. DB2 Interview Questions and Answers 2014/2015. Frequently Asked Mainframe DB2 Interview Questions With answers. Mainframe Interview Questions 2014/2015.
1.) How would you find out the total number of rows in a DB2 table?

Use SELECT COUNT(*) ... in db2 query

2.) How do you eliminate duplicate values in DB2 SELECT ?

Use SELECT DISTINCT ... in db2 query

3.) How do you select a row using indexes in DB2?

Specify the indexed columns in the WHERE clause of db2 query.

4.) How do you find the maximum value in a column in db2?

Use SELECT MAX(...) .. in db2 query

5.) How do you retrieve the first 5 characters of FIRSTNAME column of DB2 table EMP ?


6.) What are aggregate functions?

Bulit-in mathematical functions for use in SELECT clause.

7.) Can you use MAX on a CHAR column?


8.) My SQL statement SELECT AVG(SALARY) FROM EMP yields inaccurate results. Why?

Because SALARY is not declared to have NULLs and the employees for whom the salary is not known are also counted.

9.) How do you concatenate the FIRSTNAME and LASTNAME from EMP table to give a complete name?


10.) What is the use of VALUE function?

1. Avoid -ve SQLCODEs by handling nulls and zeroes in computations

2. Substitute a numeric value for any nulls used in computation

11.) Explain the function of Data Manager.

The physical database is managed by the DB2 component called Data manager. It invokes other system components to perform logging, locking etc.

12.) What is a storage group (STOGROUP)?

STOGROUP is a named collection of DASD volumes, which is to be used by index spaces and table spaces of the database.

13.) Define predicate?

Predicate is an element of a search condition. It expresses or implies a search condition.

14.) Define Declaration Generator (DCLGEN).

Declaration Generator is a facility that is used to form SQL statements that describes a table or view. At pre-compile time, the table or view descriptions are then used to check the validity of SQL statements.

15.) List out the buffer pools in DB2

There are four buffer pools in DB2 and they are:


16.) Define clustering index.

Clustering index is a type of index, which locates the table rows and determines how to group the rows together in the tablespace.

17.) What is concurrency?

More than one DB2 application process can access the same data at the same time, is known as concurrency. However, problems can happen such as, lost updates access to unrepeatable reads and uncommitted data.

18.) Explain the Function done by data manager?

Data manager can be considered as a component that is capable of managing the databases that are physically present and is capable of invoking other components associated with the system for performing functionalities like logging, locking and in performing other I/O operations.

19.) Explain about DBRM.

DBRM stands for Database Request Module and is a component inside DB2, which is created by the pre compiler of DB2. This is a module that consists of SQL source statements that get extracted out of the application program. DBRMs form inputs that are helpful in the binding process.

20.) Define Data page.

Data page can be considered as a unit that is capable of retrieving data from the database. The database from which the data can be retrieved is in the form of 4 kilobytes or 32 kilobytes. The form in which data is retrieved depends on the way the table is defined inside the database. Data page also contains information regarding the catalog or user that are part of the database.

21.) Explain about RCT.

RCT is expanded as Resource – Control Table and is defined in the DB2/CICS region. This is the component that comprises of features that are gathered through macros of DSNCRCT. RCT matches with the transaction ID that of CICS, with the authorization ID that of DB2. This should also be matched with plan ID.

22.) How can tablespace be moved to another DASD volume that is allocated for that tablespace?

Tablespace that you are using is allocated only to STOGROUP, then you can enter the command ALTER STOGROUP for adding as well as deleting volume. REORG TABLESPACE and RECOVER TABLESPACE are statements that are helpful in creating new STOGROUP that can point towards the new volume. ALTER tablespace and REORG and RECOVER are statements used for altering and recovering the tablespace allocated in the memory.

23.) What is the information associated with SYSIBM.SYSLINKS table?

This is the table that contains information on the links that exists between the tables created through referential constraints.

24.) Explain in detail about buffer manager and its functionalities?

Buffer manager can be considered as the component inside DB2 that helps in transferring data between virtual as well as external medium. The buffer manager reduces the quantity of physical input as well as output operations that are actually performed by making use of buffering techniques that are highly sophisticated.

25.) Explain about cursor stability?

Cursor stability is the property that tells the DB2 that the values of database that are read by making use of this application gets protected while the data is used.

26) How do you specify and use a cursor in a COBOL program? �

Use DECLARE CURSOR statement either in working storage or in procedure division(before open cursor), to specify the SELECT statement. Then use OPEN, FETCH rows in a loop and finally CLOSE.

27) What happens 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.

28) Is DECLARE CURSOR executable?


29) Can you have more than one cursor open at any one time in a program ? �


30) When you COMMIT, is the cursor closed? - drona db2 interview questions


31) How do you leave the cursor open after issuing a COMMIT? ( for DB2 2.3 or above only )

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

32) Give the COBOL definition of a VARCHAR field.

A VARCHAR column REMARKS would be defined as follows:





33) What is the physical storage length of each of the following DB2 data types:


DATE: 4bytes

TIME: 3bytes

TIMESTAMP: 10bytes

34) What is the COBOL picture clause of the following DB2 data types:



TIME : PIC X(08)


35) What is the COBOL picture clause for a DB2 column defined as DECIMAL(11,2)? - Ramesh

PIC S9(9)V99 COMP-3.

Note: In DECIMAL(11,2), 11 indicates the size of the data type and 2 indicates the precision.

36) What is DCLGEN ? -

DeCLarations GENerator: used to create the host language copy books for the table definitions. Also creates the DECLARE table.

37) What are the contents of a DCLGEN? -

1. EXEC SQL DECLARE TABLE statement which gives the layout of the table/view in terms of DB2 datatypes.

2. A host language copy book that gives the host variable definitions for the column names.

38) Is it mandatory to use DCLGEN? If not, why would you use it at all? -

It is not 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.

39) Is DECLARE TABLE in DCLGEN necessary? Why it used?

It not necessary 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.

40) Will precompile of an DB2-COBOL program bomb, if DB2 is down?

No. Because the precompiler does not refer to the DB2 catalogue tables.

41) How is a typical DB2 batch pgm executed ?

1. Use DSN utility to run a DB2 batch program from native TSO. An example is shown:




2. Use IKJEFT01 utility program to run the above DSN command in a JCL.

Assuming that a site�s standard is that pgm name = plan name, what is the easiest way to find out which pgms are affected by change in a table�s structure ?

Query the catalogue tables SYSPLANDEP and SYSPACKDEP.

42) Name some fields from SQLCA.


43) How can you quickly find out the # of rows updated after an update statement?

Check the value stored in SQLERRD(3).

44) What is EXPLAIN? � drona questions

EXPLAIN is used to display the access path as determined by the optimizer for a SQL statement. It can be used in SPUFI (for single SQL statement ) or in BIND step (for embedded SQL ).

45) What do you need to do before you do EXPLAIN?

Make sure that the PLAN_TABLE is created under the AUTHID.

46) Where is the output of EXPLAIN stored? �

In userid.PLAN_TABLE

47) EXPLAIN has output with MATCHCOLS = 0. What does it mean? �

a nonmatching index scan if ACCESSTYPE = I.

48) How do you do the EXPLAIN of a dynamic SQL statement?

1. Use SPUFI or QMF to EXPLAIN the dynamic SQL statement

2. Include EXPLAIN command in the embedded dynamic SQL statements

49) How do you simulate the EXPLAIN of an embedded SQL statement in SPUFI/QMF? Give an example with a host variable in WHERE clause.)

Use a question mark in place of a host variable ( or an unknown value ). e.g.




DB2 Interview Questions - PART III

50) What are the isolation levels possible ?

CS: Cursor Stability

RR: Repeatable Read