Entering content frame

 INCLUDE DECLARE Statement 

Use

You can use the INCLUDE DECLARE statement to generate structure definitions.

Prerequisites

·        The precompiler must run with the precompiler option check, so that the application program gets the information it requires from the database instance.

·        The file <filename> must not exist. If it exists, an INCLUDE FILE statement is executed instead of the INCLUDE DECLARE statement.

Syntax

EXEC SQL INCLUDE <file_name> <declare_clause>
[<as_clause>] [<ind_clause>];

<declare_clause> ::= <table_clause> | <dbproc_clause>

<table_clause>   ::= TABLE <table_name>

<dbproc_clause>  ::= DBPROC <dbproc_name>

<as_clause>      ::= AS VAR [<variable_declarator>]
|                    AS TYPE [<type_declarator>]
|                    AS STRUCT [<structure_tag>]

<ind_clause>     ::= IND [<ind_variable_declarator>] [<structure_tag>]

·        AS VAR generates a variable declaration. AS TYPE generates a type declaration. AS STRUCT generates a structure declaration.

·        If you do not specify an AS clause, the INCLUDE DECLARE generates a variable declaration by default.

·        The default name of the structure definition is the name of the database table or procedure. However, you can also choose another name in the AS clause.

·        The names of the structure components are derived from the column names of the table. The data types of the structure components are compatible with the data types of the corresponding table columns.

·        You use the IND clause to generate another structure definition that you can specify as a type definition when you declare the indicator variables.

·        If you do not specify a name in <structure_tag>, then, by default, the name of the structure definition for the indicator variable is generated from the table name and preceded by an I.

·        The names of the structure components for the indicator variable are, by default, derived from the table name and the column names, preceded by an i.

·        The data types of the structure components are short int.

·        If the table contains columns with the data type long, then the precompiler generates, as a structure component, a character string with 32767 characters for each of these columns, and displays a warning on the screen. You can then redefine or modify these structure components in the source code.

 

Leaving content frame