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

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

DATE, TIME, TIMESTAMP?

DATE: 4bytes

TIME: 3bytes

TIMESTAMP: 10bytes

 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)

 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.

 What is DCLGEN ? –

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

 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.

 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.

 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.

Advertisements