3. Embedded SQL for COBOL : COBOL Data Items and Data Types : Variable Usage : Elementary Data Items
 
Share this page                  
Elementary Data Items
To refer to a simple scalar-valued data item (numeric, alphanumeric, or alphabetic), use the following syntax:
:simplename
The following program fragment demonstrates a typical error handling paragraph. The data items BUFFER and SECONDS are scalar-valued variables.
Example: Elementary data items usage
DATA DIVISION.
WORKING-STORAGE SECTION.

EXEC SQL BEGIN DECLARE SECTION END-EXEC.

01 SECONDS PIC S9(4) USAGE COMP.
01 BUFFER PIC X(100).
EXEC SQL END DECLARE SECTION END-EXEC.

* Program code

ERROR-HANDLE.

EXEC FRS MESSAGE :BUFFER END-EXEC.
EXEC FRS SLEEP :SECONDS END-EXEC.

*More error code.