Begins a declare section, which declares host language variables used in an Embedded SQL source file.
exec sql begin declare section end-exec host_variable_declaration. ...
exec sql end declare section end-exec
The declaration of one or more host language variables.
EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 TITLE PIC X(80).
01 VAR1PIC S9(9) COMP.
01 VAR2 PIC X(100).
EXEC SQL END DECLARE SECTION END-EXEC.
A declare section must end with the Embedded SQL statement end declare section.
A source file can have any number of declare sections.
declare sections can be placed anywhere that variables can be declared. The declare section that declares a variable must precede any statement that references the variable.
Variable declarations in a declare section must conform to the rules of the host language.
Nested structures are valid in a declare section; arrays of structures are not.
A declare section can contain any number of Embedded SQL include statements.
In Embedded SQL/C routines, the Client-Library datatypes defined in cspublic.h can be used in declare sections.
In C routines, you can declare two-dimensional arrays of characters but only one-dimensional arrays of other datatypes.
When processing declare sections, the Embedded SQL precompiler ignores C preprocessor macros and #include statements. When processing Embedded SQL include statements within a declare section, the Embedded SQL precompiler treats the contents of the included file as though had been entered directly into the file being precompiled.
exec sql include "filename"