SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
Embedded-Only SQL/MX Statements
HP NonStop SQL/MX Reference Manual—523725-004
3-37
END DECLARE SECTION Declaration
END DECLARE SECTION Declaration
END DECLARE SECTION is a preprocessor directive that ends SQL declarations in a 
host program. SQL declarations are used to define host variables to be used in 
SQL/MX statements—for example, to transfer data to and from a database.
Use END DECLARE SECTION only in embedded SQL programs in C or COBOL. 
See BEGIN DECLARE SECTION Declaration on page 3-9.
C Examples of END DECLARE SECTION
•
This example shows a declaration section in a C program:
EXEC SQL BEGIN DECLARE SECTION;
 short length;
 char data[10];
EXEC SQL END DECLARE SECTION;
C++ Examples of END DECLARE SECTION
•
This example shows a declaration section within a class in a C++ program. 
Member functions using these host variables must be defined within the visible 
scope of the class.
class jobsql {
// Class member host variables
EXEC SQL BEGIN DECLARE SECTION;
 short length; 
 VARCHAR data[19];
EXEC SQL END DECLARE SECTION;
public:
... // Member functions referencing these host variables
 }
}; // End of jobsql class definition
COBOL Examples of END DECLARE SECTION
•
This example shows a declaration section in a COBOL program:
 EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 length pic 9(4)comp.
01 data pic x(10).
 EXEC SQL END DECLARE SECTION END-EXEC.
END DECLARE SECTION
C/COBOL










