DB2

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

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.]

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

Runstats
[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.]

Cardinality
[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.]

I. [Group by can allow you to group like data values of columns together] Critical Success Factor: 1. How would you sort DB2 data returned in a query? [Candidate should readily know that order by clause should be used] 5.] 6. Unit of work will be rolled back. Describe what you would use GROUP BY clause for. procs. [QMF can be used to run several queries as procs] 4. R. Experience using SPUFI and QMF Rank ( 0 . If they have used another tool such as FILEAID.SQL CODES : +100 -805 -803 -911 -530 -811 Not found. [Candidate must be familiar with these two tools and site examples where they have used one or both of them in the past.] 2. Explain the strengths and weaknesses of each. 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(*). Familiarity with embedded SQL Rank ( 0 . (This of course is dependent on batch processing implementing a restart procedure.5): Critical Success Factor: 1. Describe your experience using SPUFI and QMF. Have you ever used batch QMF? If so. forms and edit table functions. [Generally SPUFI is considered a good tool to create queries to look at raw data.)] . describe the circumstances. error More than 1 row was returned on a select statement in a COBOL program.5): 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. QMF is a good tool for reports. Bind error where time-stamp on DBRM does not match the load module Duplicate key Deadlock or time-out. It will also reduce the unit of work for the rollback if the program abends and reduce the work at restart time. ask them to explain that. How would you eliminate duplicate rows in a query? [Candidate should know that the DISTINCT clause should be used] 7. 3. Determine whether the candidate coded the DB2 calls using these tools or used prompted panels.

] 3.] 3. If a row exists. Knowledge of referential integrity concepts..2. defined on a table with delete restrictions.I.I.I. Explain how R. might prevent you from inserting data into a table. Explain what process you would need to undertake if data has been committed in your batch program but abnormally terminated prior to completion.] 4.] Critical Success Factor: 1. you would not be able to delete a row which was defined as a foreign key that does exist on a child table. [Candidate should be aware that with R. you would not be able to insert a row which was defined as a foreign key that did not exist. defined on a table. In order to commit data.I. Explain how you would need to code the retrieval of null data in a COBOL program. [This process goes with the question above. It is best to commit data at completion of a unit of work.I.] 5. Describe an example of how you have used this in the past.] . Explain the 3 delete rules associated with table related R. When processing resumes. a restart process such as a restart table which would store the key of the sequential input file would need to be in place.e.] 4.5): Explain the concept of R. Would you use the same approach in an on-line program? What other considerations would be needed? [The candidate should be aware that it is not a good practice to commit data using on-line transactions processing. Explain what null represents. 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.. the program would check a restart table to see if any entries exist for the program.(i. might prevent you from deleting data from a table. Rank ( 0 . Explain how R. date of cancellation would be unknown if status would be active. An example of this would be that a customer could not be delete if they had outstanding orders. Dates are usually a good candidate for null date. the program should resume processing with the next record on the input file. spaces or low values.I. An example of this would be that an order could not be entered for a customer number which was not on the customer table.] 2. [Candidate should be aware that with R.restrict. [Candidate should be able to explain the 3 rules . cascade & set to null. [Candidate should be able to explain this concept and site whether this was built into the tables or addressed programatically. They should be able to convey that null represents an unknown value which is different than zero. What type of data is best suited for null data? [The candidate should be familiar with the concept of examining a null indicator. How would you ensure concurrency in an on-line system where multiple users could update the same tables? [Candidate should be able to explain concurrency.

Also explain what will occur if you fail to do this. Runstats. A plan contains the access paths for all DBRMs bound to it. ] Critical Success Factor: 1. Load resume is like a mod file in that it copies the data after the existing data. Rank ( 0 . authority to execute packages. Knowledge of DBRM lib concepts and associations. It contains the program’s SQL] 2.5): Explain the coding steps you need to implement in your program when retrieving more than one row of data from a table.] If LOAD experience . [Load replace is like the disp of old and will replace the existing data and reset the indexes.5): Describe any DB2 related utilities you have used or are familiar with. Note : The interviewer would need a strong DB2 background to ask this.] Critical Success Factor: 1. This is input to the bind. Syscolumns. ] . a package is not. Describe the difference between a package and a plan.] 2. [Utilities might include Load. Failure to use a cursor would return a SQL (-811) error in the program. Knowledge of cursor processing concepts.Critical Success Factor: 1. The plan is executable in conjunction with a program. either explicitly or via a package. Sysindexes. Load & unload utilities are sometimes used on teams for create test data] If no experience. [There are many system tables including Systables. Which tables or views contain a column name. Rank ( 0 . fetch and close logic in the program. [In some shops. Etc. open. Unload. Describe what type of information can be found in the DB2 System Catalog.explain the difference between LOAD resume and LOAD replace. [Candidate should be able to explain that you would need to set up a cursor using declare. inquire who performed these utilities and what relationship your position was in relation to theirs. [A package contains access paths for a single DBRM. A package cannot be executed until it is bound to a plan. Name 3 of these tables & explain what useful information that they could convey. What process is it used as input for? [A DBRM is a database request module which is created during the preprocess compiler. the DBA groups typically perform these functions. The DB2 catalog conveys data such as all columns defined to a table and their data types. Syspackages. Experience using DB2 utilities & Catalogue Rank ( 0 .5): Explain what is a DBRM and where it is created.

] Critical Success Factor: 1. Committing the data frequently will also reduce locking problems. Demonstrates proper table design and performance tuning insight Rank ( 0 . A high cluster ratio will have a positive impact on performance when using an index.3. VGI uses these to segregate data for different groups to eliminate hard coding in programs by setting the current packageset to the host variable.the rollback of uncommitted work for abends & restart must be considered as part of their batch processing window. [Normalization eliminates duplicate data thus reducing the space overhead for maintaining them.] 4. For sequential processing of large amounts of date. In a long running process the commit should be done periodically . Have you ever used collection ids with packages? If so describe their concept and advantages? [Collections are groupings of DB2 tables and packages. what the default value would be and how to populate data for the existing rows.] 7. They would need to decided such things as if the new column would allow nulls. He would need to regenerate the dclgen and possibly modify load/unload utilities and identify existing packages which would be effected. Site instances where you may want to use one.] 5. Describe what you would need to in order to design/implement this. it can simplify the SQL because the data is easier to access.] 3.] 2. What is an index? Explain the positive and negative impact indexes can have on performance. De-normalization can be an advantage for performance issues. can or cannot be unique and most times will retrieve the data quicker than not using one. [The candidate should be aware that indexes are an alternative way to access the data rather than scanning the entire table. ] . 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. Explain what is meant by table space scan.5): Describe the respective benefits of Normalization and De-normalization. What is clustering and how can it effect performance? [Clustering determines how the rows are physically ordered in a tablespace. An additional column needs to be added to an existing table. this would be the preferred method. [The candidate should suggest that he would need to work with the database group to alter the table.] 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. [The candidate should understand that this means accessing or searching every row on the table. They come in various types.

indexes accessed. invoking a sort and other performance related issues. several more tables would not be a problem. Ex . Dept_name from employ a.Critical Success Factor: 1. 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. Familiarity with EXPLAIN logic Rank ( 0 . it is likely that a different access path will be chosen for the same call. How many tables have you typically coded in joins? What types of things would you need to consider when coding joins. It is needed when one SQL statement depends on the results of another.] Critical Success Factor: 1.] 3.] 2. [The candidate should be aware that if the catalog stats are different on the two system.dept_no ] 3. Describe some of the columns on the plan table and what they might be useful for. Familiarity with sub-selects and joins Rank ( 0 .Select employee_name. the explain would process the same results even though the amount of data is dramatically different. 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. In this way. One way to get around this would be have the DBA update the catalog stats to match & then run Runstats. sort columns . [If tables were large(millions) it would be expected that the number of tables joined would be low (3 or less). [The candidate should be able to explain or write this down with little effort. type.] .5): If you specify explain(yes) in your bind setup. Give example of how you would use join to retrieve employee name from one table and the department name from a 2nd table. You may ask the candidate to explain if these were used in batch or on-line processing. [A subselect is a select query that is nested inside another query. what additional information will you have access to? Where will you find this data? [By using the explain option.dept_no = b.5): Describe the difference between a join and a sub-select. if composite tables were created are some of the information that you would evaluate. index use. ] 2. If the number of rows on the table were small (hundreds or thousand). [Access method. 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. dept b where a.

Rank ( 0 .5): 1. What formal DB2 training have you received? How long ago did you receive it? .Critical Success Factor: Has received DB2 training.