21.How would you retrieve rows from a DB2 table in embedded SQL?Either by using the single row SELECT statements, or by using the CURSOR. 22.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. 23.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. 24.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. 25.Give the COBOL definition of a VARCHAR field.?A VARCHAR column REMARKS would be defined as follows: 26.What is the physical storage length of each of the following DB2 data types:?DATE, TIME, TIMESTAMP? 27.What is the COBOL picture clause of the following DB2 data types:?DATE, TIME, TIMESTAMP? 28.What is the COBOL picture clause for a DB2 column defined as DECIMAL(11,2)?PIC S9(9)V99 COMP-3. 29.What is DCLGEN ?DeCLarations GENerator: used to create the host language copy books for the table definitions. Also creates the DECLARE table. 30.What are the contents of a DCLGEN?
31.Is it mandatory to use DCLGEN? If not, why would you use it at all?It is not mandatory to use DCLGEN. 32.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. 33.Will precompile of an DB2-COBOL program bomb, if DB2 is down?No. Because the precompiler does not refer to the DB2 catalogue tables. 34.How is a typical DB2 batch pgm executed ?
RUN PROGRAM(EDD470BD) PLAN(EDD470BD) LIB('ED 01T.OBJ.LOADLIB') END 35.Name some fields from SQLCA.SQLCODE, SQLERRM, SQLERRD 36.How can you quickly find out the # of rows updated after an update statement?Check the value stored in SQLERRD(3). 37.What is EXPLAIN? – drona questionsEXPLAIN 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 ). 38.What do you need to do before you do EXPLAIN?Make sure that the PLAN_TABLE is created under the AUTHID. 39.Where is the output of EXPLAIN stored?In userid.PLAN_TABLE 40.EXPLAIN has output with MATCHCOLS = 0. What does it mean?a nonmatching index scan if ACCESSTYPE = I. |