3. Embedded SQL for COBOL : COBOL Data Items and Data Types : Variable and Type Declarations : Embedded SQL Variable Declaration Sections
 
Share this page                  
Embedded SQL Variable Declaration Sections
Declare COBOL data items to SQL in a declaration section. This section has the following syntax:
exec sql begin declare section end-exec
COBOL variable declarations
exec sql end declare section end-exec
Place the declaration section in either the File or Working‑Storage Section of the Data Division.
Embedded SQL variable declarations are global to the program file from the point of declaration onwards. You can incorporate multiple declaration sections into a single file when, for example, multiple COBOL programs appear in the same file. Each program can have its own declaration section. For more information, see The Scope of Variables in this chapter.