BEGIN DECLARE SECTION

The BEGIN DECLARE SECTION statement notifies the precompiler that an SQL declare section follows. You can use this statement only in SQL that is embedded in a program.
idmscu19
The BEGIN DECLARE SECTION statement notifies the precompiler that an SQL declare section follows. You can use this statement only in SQL that is embedded in a program.
Authorization
None required.
Syntax
►►── BEGIN DECLARE SECTION ───────────────────────────────────────────────────►◄  
Parameter
  • BEGIN DECLARE SECTION.
    Notifies the precompiler that an SQL declare section follows. An SQL declare section contains the definition of one or more host variables.
Usage
Declaring Host Variables
You can:
  • Place an SQL declare section in an application program wherever host language rules allow variable declarations
  • Define any number of host variable declarations in an SQL declare section
  • Include any number of SQL declare sections in a single application program
Example
Beginning and Ending an SQL Declaration Section
In this COBOL example, BEGIN DECLARE SECTION begins an SQL declare section and END DECLARE SECTION ends it. The SQL declare section contains the definition of five host variables.
WORKING-STORAGE SECTION.  .  .  .  EXEC SQL BEGIN DECLARE SECTION END-EXEC    01  HV-EMP-ID           PIC S9(8)     USAGE COMP.    01  HV-EMP-LNAME        PIC X(20).    01  HV-SALARY-AMOUNT    PIC S9(6)V(2) USAGE COMP-3.    01  HV-PROMO-DATE       PIC X(10).    01  HV-PROMO-DATE-I     PIC S9(4)     USAGE COMP.  EXEC SQL END DECLARE SECTION END-EXEC
More Information