The largest Interview Solution Library on the web


Interview Questions
« Previous | 0 | 1 | 2 | 3 | 4 | Next »

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.
Apart from cursor, what other ways are available to you to retrieve a row from a table in embedded SQL? -
Single row SELECTs.

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:
...
10 REMARKS.
49 REMARKS-LEN PIC S9(4) USAGE COMP.
49 REMARKS-TEXT PIC X(1920).

26.What is the physical storage length of each of the following DB2 data types:?

DATE, TIME, TIMESTAMP?
DATE: 4bytes
TIME: 3bytes
TIMESTAMP: 10bytes

27.What is the COBOL picture clause of the following DB2 data types:?

DATE, TIME, TIMESTAMP?
DATE: PIC X(10)
TIME : PIC X(08)
TIMESTAMP: PIC X(26)

28.What is the COBOL picture clause for a DB2 column defined as DECIMAL(11,2)?

PIC S9(9)V99 COMP-3.
Note: In DECIMAL(11,2), 11 indicates the size of the data type and 2 indicates the precision.

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?

  • EXEC SQL DECLARE TABLE statement which gives the layout of the table/view in terms of DB2 datatypes.
  • A host language copy book that gives the host variable definitions for the column names.

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

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 ?

  • Use DSN utility to run a DB2 batch program from native TSO. An example is shown:
  • DSN SYSTEM(DSP3)
    RUN PROGRAM(EDD470BD) PLAN(EDD470BD) LIB('ED 01T.OBJ.LOADLIB')
    END
  • 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.

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

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.

« Previous | 0 | 1 | 2 | 3 | 4 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com