Thursday, February 16, 2006

Interview Questions

How do you find the second max and second min in a given table?

Ans-1.

SELECT MAX(COLA) FROM TABLENAME WHERE COLA < (SELECT MAX(COLA) FROM

TABLENAME) ;

SELECT MIN(COLA) FROM TABLENAME WHERE COLA > (SELECT MIN(COLA) FROM

TABLENAME) ;

What is a two-phase commit?

It is a process that synchronizes the commit and rollback of changes between 2 different environments (like CICS to DB2 or IMS to DB2).

What can cause it to fail? How can you resolve this ?

If a connection/communication failure or an environment crash in either environment occurs. When such a failure happens, the commit status of the thread established for that connection is in doubt.

One can invoke the RECOVER INDOUBT command to commit or rollback any changes associated with an in-doubt thread.

In a CICS program, if PGM-A with PLAN-A transferred control to PGM-B with PLAN-B, which plan would take effect ? Why ?

PLAN-A of PGM-A is still in effect because a CICS SYNCPOINT was not done before transferring control to PGM-B.

What is a NULL value? What are the pros and cons of using NULLS?

A. A NULL value takes up one byte of storage and indicates that a value is not present as opposed to a space or zero value. It's the DB2 equivalent of TBD on an organizational chart and often correctly portrays a business situation. Unfortunately, it requires extra coding for an application program to handle this situation

What will the STOSPACE utility do ?

This updates the DB2 catalog columns to tell how much space is allocated for storage groups and related tablespace and indexes.

What will the QUIESCE utility do ?

It ensures table data consistency and referential integrity. It does this by recording log RBAs in the SYSIBM.SYSCOPY catalog table, which can later be used by the RECOVER utility. It is recommended to run QUIESCE before running a COPY because of this.

What will the RUNSTATS utility do ?

It will scan tablespaces or indexes gathering information about utilization of space and efficiency of indexes. The information is tored in the DB2 catalog, and is used by the DB2 optimizer to select access paths to data during the bind process.