Including declarations from DCLGEN in your program

After you use DCLGEN to produce declarations for tables, views, and variables for your C, COBOL, or PL/I program, you should include these declarations in your program.

Before you begin

Recommendation: To ensure that your program uses a current description of the table, use DCLGEN to generate the table's declaration and store it as a member in a library (usually a partitioned data set) just before you precompile the program.

Procedure

To include declarations from DCLGEN in your program:

Code the following SQL INCLUDE statement in your program:
EXEC SQL
  INCLUDE member-name
END-EXEC.
member-name is the name of the data set member where the DCLGEN output is stored.

Example

Suppose that you used DCLGEN to generate a table declaration and corresponding COBOL record description for the table DSN8D10.EMP, and those declarations were stored in the data set member DECEMP. (A COBOL record description is a two-level host structure that corresponds to the columns of a table's row. ) To include those declarations in your program, include the following statement in your COBOL program:
EXEC SQL
  INCLUDE DECEMP
END-EXEC.