Home Interview Questions and AnswersTechnical Interview Questions and AnswersDB2 Mainframe DB2 Interview Questions and Answers Part-4

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

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

33) What is the physical storage length of each of the following DB2 data types:

DATE, TIME, TIMESTAMP?

DATE: 4bytes

TIME: 3bytes

TIMESTAMP: 10bytes

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

35) What is the COBOL picture clause for a DB2 column defined as DECIMAL(11,2)? – Ramesh

PIC S9(9)V99 COMP-3.

Note: In DECIMAL(11,2), 11 indicates the size of the data type and 2 indicates the precision.

36) What is DCLGEN ? –

DeCLarations GENerator: used to create the host language copy books for the table definitions. Also creates the DECLARE table.

37) What are the contents of a DCLGEN? –

1. EXEC SQL DECLARE TABLE statement which gives the layout of the table/view in terms of DB2 datatypes.

2. A host language copy book that gives the host variable definitions for the column names.

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

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

40) Will precompile of an DB2-COBOL program bomb, if DB2 is down?

No. Because the precompiler does not refer to the DB2 catalogue tables.

You may also like

Leave a Comment