You can define cursors in both the Data Division and the Procedure Division. Note that when cursors are defined in the Data Division, the period (.) after the END-EXEC keyword is optional. However, if you do include the period, it must appear on the same line as the END-EXEC keyword. Therefore, both of the following are acceptable syntax when a cursor is defined in the Data Division section.
EXEC SQL
DECLARE COBCUR1 CURSOR FOR
SELECT
C_FIRST_NAME,
C_LAST_NAME,
FROM CUSTOMER
WHERE C_NUMBER >= 'SMITH'
END-EXEC.
EXEC SQL
DECLARE COBCUR1 CURSOR FOR
SELECT
C_FIRST_NAME,
C_LAST_NAME,
FROM CUSTOMER
WHERE C_NUMBER >= 'SMITH'
END-EXEC
See Cursors for a brief introduction to cursors. Refer to any of the commercially available books on SQL for more complete details.