END DECLARE SECTION

The END DECLARE SECTION statement (embedded SQL only) marks the end of a host variable declaration block in an application program.

Invocation

END DECLARE SECTION is not an executable statement. It can only be embedded in a host language.

Authorization

No special authorization is required.

Syntax

END DECLARE SECTION

Description

END DECLARE SECTION may be used in an application program to mark the end of the section of code where host variables are declared. If an END DECLARE SECTION is used, the host variable declaration section must begin with the BEGIN DECLARE SECTION statement.

When programming in C, or when the DECLARE or ANSI COBOL preprocessor directives are used, BEGIN and END DECLARE SECTION commands must surround the declarations for all host variables, creating host variable declaration blocks. The host variable declaration blocks can appear anywhere the host language allows variable declarations, but they cannot be nested.

Example:

EXEC SQL BEGIN DECLARE SECTION; 
    short in cust_num = 28; 
    char name[30];
EXEC SQL END DECLARE SECTION;