You are on page 1of 7


Critical Success Familiarity with basic DB2 terms and Rank ( 0 - 5):
Factor: codes

These questions require short/simple answers to determine the candidate’s level of familiarity with
DB2. The first seven should be especially easy for anyone with a working knowledge of DB2 to
answer without hesitation.

Sqlcode -
[This is the return code from the SQL call.]

Declare cursor -
[This is needed in a COBOL program where more than 1 row will be returned. It is a SQL call which is typically coded in
working storage. ]

Fetch -
[Fetch is a corresponding call to the declare cursor. It actually retrieves the row into the host variables that are coded in the
declare cursor statement.]

View -
[A view is an alternative representation of a DB2 table. It may contain all of some of the columns of the actual table. (The
DBA usually references the table while the programmer usually is only concerned with the view.)]

Host variable -
[This must be defined & coded in the COBOL program to hold the data returned from DB2. It needs to be the same data type
so if possible using fields in the dclgen is usually the best practice. ]

Dclgen -
[This is the COBOL copybook which gets generated by the DB2 catalog.]

Foreign key -
[A foreign key identifies a related row in another table and establishes a logical relationship between rows in the two tables.]

Dsntiar -
[This is the IBM supplied program which formats the SQL error codes in text message. It is commonly used in error
processing routines.]

[Entry defined in CICS which ties the CICS transaction to the DB2 plan.]

[The RUNSTATS utility collects statistics about DB2 objects. These statistics can be stored in the DB2 catalog, and are
used during the bind process to choose the path in accessing data. If you never use RUNSTATS and subsequently rebind
your packages or plans, DB2 will not have the information it needs to choose the most efficient access path. This can result
in unnecessary I/O operations and excessive processor consumption.]

[This is the number of unique values for a columns. Columns with low cardinality are not good candidates for indexing.
Sometimes columns are concatenated together to use as indexes because used alone the optimizer would not elect to use
the index.]

+100 Not found.

-805 Bind error where time-stamp on DBRM does not match the load module
-803 Duplicate key
-911 Deadlock or time-out. Unit of work will be rolled back.
-530 R.I. error
-811 More than 1 row was returned on a select statement in a COBOL program.

Critical Success Experience using SPUFI and QMF Rank ( 0 - 5):


1. Describe your experience using SPUFI and QMF.

[Candidate must be familiar with these two tools and site examples where they have used one or both of them in the past. If
they have used another tool such as FILEAID, ask them to explain that. Determine whether the candidate coded the
DB2 calls using these tools or used prompted panels.]

2. Explain the strengths and weaknesses of each.

[Generally SPUFI is considered a good tool to create queries to look at raw data. QMF is a good tool for reports, procs,
forms and edit table functions.

3. Have you ever used batch QMF? If so, describe the circumstances.
[QMF can be used to run several queries as procs]

4. How would you sort DB2 data returned in a query?

[Candidate should readily know that order by clause should be used]

5. What would you do if you needed to find the number of rows of a particular table?
[The easiest way to find this out would be to query the table with the select count(*).]

6. How would you eliminate duplicate rows in a query?

[Candidate should know that the DISTINCT clause should be used]

7. Describe what you would use GROUP BY clause for.

[Group by can allow you to group like data values of columns together]

Critical Success Familiarity with embedded SQL Rank ( 0 - 5):


1. Explain why you might commit updates to a DB2 table in batch processing mode before the program
comes to completion?
[Committing the data will reduce locking problems. It will also reduce the unit of work for the rollback if the program abends
and reduce the work at restart time. (This of course is dependent on batch processing implementing a restart
2. Explain what process you would need to undertake if data has been committed in your batch program
but abnormally terminated prior to completion.
[This process goes with the question above. In order to commit data, a restart process such as a restart table which would
store the key of the sequential input file would need to be in place. When processing resumes, the program would
check a restart table to see if any entries exist for the program. If a row exists, the program should resume processing
with the next record on the input file.]

3. Would you use the same approach in an on-line program? What other considerations would be
[The candidate should be aware that it is not a good practice to commit data using on-line transactions processing. It is best
to commit data at completion of a unit of work.]

4. Explain how you would need to code the retrieval of null data in a COBOL program. Explain what
null represents. What type of data is best suited for null data?
[The candidate should be familiar with the concept of examining a null indicator. They should be able to convey that null
represents an unknown value which is different than zero, spaces or low values. Dates are usually a good candidate
for null date- (i.e. date of cancellation would be unknown if status would be active.]

5. How would you ensure concurrency in an on-line system where multiple users could update the same
[Candidate should be able to explain concurrency. One common technique used involves storing the time-stamp when the
row was last updated and then comparing this to the one on the database prior to updating the table again.]

Critical Success Knowledge of referential integrity Rank ( 0 - 5):

Factor: concepts.

1. Explain the concept of R.I.. Describe an example of how you have used this in the past.

[Candidate should be able to explain this concept and site whether this was built into the tables or addressed

2. Explain how R.I. might prevent you from inserting data into a table.

[Candidate should be aware that with R.I. defined on a table, you would not be able to insert a row which was defined as a
foreign key that did not exist. An example of this would be that an order could not be entered for a customer number
which was not on the customer table.]

3. Explain how R.I. might prevent you from deleting data from a table.

[Candidate should be aware that with R.I. defined on a table with delete restrictions, you would not be able to delete a row
which was defined as a foreign key that does exist on a child table. An example of this would be that a customer could
not be delete if they had outstanding orders.]

4. Explain the 3 delete rules associated with table related R.I..

[Candidate should be able to explain the 3 rules - restrict, cascade & set to null.]
Critical Success Knowledge of cursor processing Rank ( 0 - 5):
Factor: concepts.

1. Explain the coding steps you need to implement in your program when retrieving more than one row
of data from a table. Also explain what will occur if you fail to do this.

[Candidate should be able to explain that you would need to set up a cursor using declare, open, fetch and close logic
in the program. Failure to use a cursor would return a SQL (-811) error in the program. ]

Critical Success Experience using DB2 utilities & Rank ( 0 - 5):

Factor: Catalogue

1. Describe any DB2 related utilities you have used or are familiar with.

[Utilities might include Load, Unload, Runstats. Load & unload utilities are sometimes used on teams for create test data]

If no experience, inquire who performed these utilities and what relationship your position was in
relation to theirs.

[In some shops, the DBA groups typically perform these functions.]

If LOAD experience - explain the difference between LOAD resume and LOAD replace.

[Load replace is like the disp of old and will replace the existing data and reset the indexes. Load resume is like a mod file in
that it copies the data after the existing data.]

2. Describe what type of information can be found in the DB2 System Catalog. Name 3 of these tables
& explain what useful information that they could convey.

[There are many system tables including Systables, Syscolumns, Syspackages, Sysindexes. The DB2 catalog
conveys data such as all columns defined to a table and their data types. Which tables or views contain a column
name, authority to execute packages. Etc.

Note : The interviewer would need a strong DB2 background to ask this.]

Critical Success Knowledge of DBRM lib concepts and Rank ( 0 - 5):

Factor: associations.

1. Explain what is a DBRM and where it is created. What process is it used as input for?

[A DBRM is a database request module which is created during the preprocess compiler. This is input to the bind. It contains
the program’s SQL]

2. Describe the difference between a package and a plan.

[A package contains access paths for a single DBRM. A package cannot be executed until it is bound to a plan.
A plan contains the access paths for all DBRMs bound to it, either explicitly or via a package. The plan is executable in
conjunction with a program, a package is not. ]
3. Have you ever used collection ids with packages? If so describe their concept and advantages?

[Collections are groupings of DB2 tables and packages. VGI uses these to segregate data for different groups to
eliminate hard coding in programs by setting the current packageset to the host variable.]

Critical Success Demonstrates proper table design and Rank ( 0 - 5):

Factor: performance tuning insight

1. Describe the respective benefits of Normalization and De-normalization.

[Normalization eliminates duplicate data thus reducing the space overhead for maintaining them. De-normalization can be an
advantage for performance issues, it can simplify the SQL because the data is easier to access.]

2. An additional column needs to be added to an existing table. Describe what you would need to in
order to design/implement this.

[The candidate should suggest that he would need to work with the database group to alter the table. They would need to
decided such things as if the new column would allow nulls, what the default value would be and how to populate data
for the existing rows. He would need to regenerate the dclgen and possibly modify load/unload utilities and identify
existing packages which would be effected.]

3. Have you worked with large tables? How many rows? What were the challenges and how did
you overcome them?

[Look for experience in dealing with problems such as performance which usually go hand in hand with large tables.]

4. What is clustering and how can it effect performance?

[Clustering determines how the rows are physically ordered in a tablespace. A high cluster ratio will have a positive impact
on performance when using an index.]

5. What is an index? Explain the positive and negative impact indexes can have on performance.

[The candidate should be aware that indexes are an alternative way to access the data rather than scanning the entire table.
They come in various types, can or cannot be unique and most times will retrieve the data quicker than not using one.]

6. How would you determine the intervals for committing work in a batch processing program?

[The candidate should understand that committing data need to be done at a unit of work level. In a long running process
the commit should be done periodically - the rollback of uncommitted work for abends & restart must be considered as
part of their batch processing window. Committing the data frequently will also reduce locking problems.]

7. Explain what is meant by table space scan. Site instances where you may want to use one.

[The candidate should understand that this means accessing or searching every row on the table. For sequential
processing of large amounts of date, this would be the preferred method. ]
Critical Success Familiarity with sub-selects and joins Rank ( 0 - 5):

1. Describe the difference between a join and a sub-select.

[A subselect is a select query that is nested inside another query. It is needed when one SQL statement depends on the
results of another. A join is executed in one DB2 call and combines columns of 2 or more tables by matching data
column values in the where clause.]

2. Give example of how you would use join to retrieve employee name from one table and the
department name from a 2nd table.

[The candidate should be able to explain or write this down with little effort.

Ex - Select employee_name, Dept_name

from employ a, dept b
where a.dept_no = b.dept_no ]

3. How many tables have you typically coded in joins? What types of things would you need to
consider when coding joins.

[If tables were large(millions) it would be expected that the number of tables joined would be low (3 or less). If the
number of rows on the table were small (hundreds or thousand), several more tables would not be a problem.

You may ask the candidate to explain if these were used in batch or on-line processing.]

Critical Success Familiarity with EXPLAIN logic Rank ( 0 - 5):


1. If you specify explain(yes) in your bind setup, what additional information will you have access to?
Where will you find this data?

[By using the explain option, the candidate should be able to convey that an entry in a plan table will be created which will
give us information regarding the access path, index use, invoking a sort and other performance related issues. ]

2. Describe some of the columns on the plan table and what they might be useful for.

[Access method, type, indexes accessed, sort columns , if composite tables were created are some of the information that
you would evaluate.]

3. If you had a production database consisting of millions of rows and a test one consisting of a mere
hundred, explain how this would impact evaluating the plan table and any suggestions you might
have to overcome this.

[The candidate should be aware that if the catalog stats are different on the two system, it is likely that a different
access path will be chosen for the same call. One way to get around this would be have the DBA update the catalog
stats to match & then run Runstats. In this way, the explain would process the same results even though the amount of
data is dramatically different.]
Critical Success Has received DB2 training. Rank ( 0 - 5):

1. What formal DB2 training have you received? How long ago did you receive it?