Delimits the end of a host language variable declaration section in a precompiled program.
1 – Environment
You can use the END DECLARE statement embedded in host language programs to be precompiled.
2 – Format
EXEC SQL --> BEGIN DECLARE SECTION --> ; ---+ +-------------------------------------------+ +-+-> <host language variable declaration> -+-+ +---------<-------------------------------+ | +---------------------------------------------+ +-> EXEC SQL --> END DECLARE SECTION --> ;
3 – Arguments
3.1 – BEGIN_DECLARE_SECTION
Delimits the beginning of a host language variable declaration.
3.2 – END_DECLARE_SECTION
Delimits the end of host language variable declarations.
3.3 – ;_(semicolon)
Terminates the BEGIN DECLARE and END DECLARE statements. Which terminator you use depends on the language in which you are embedding the host language variable. The following table shows which terminator to use: Required SQL Terminator END BEGIN DECLARE DECLARE Host Language Statement Statement COBOL END-EXEC END-EXEC FORTRAN None required None required Ada, C, Pascal, or ; (semicolon) ; (semi- PL/I colon)
3.4 – host_language_variable_declaration
Specifies a variable declaration embedded within a program. See the User_Supplied_Names HELP topic for more information on host language variable definitions.
4 – Examples
Example 1: Declaring a host language variable within a BEGIN . . . END DECLARE block The following example shows portions of a PL/I program. The first part of the example declares the host language variable LNAME within the BEGIN DECLARE and END DECLARE statements. The semicolon is necessary as a terminator because the language is PL/I. The second part of the example shows a singleton SELECT statement that specifies a one-row result table. The statement assigns the value in the row to the previously declared host language variable LNAME. EXEC SQL BEGIN DECLARE SECTION; DECLARE LNAME char(20); EXEC SQL END DECLARE SECTION; . . . EXEC SQL SELECT FIRST_NAME INTO :LNAME FROM EMPLOYEES WHERE EMPLOYEE_ID = "00164";