Was this helpful?
Terminator
The terminator for COBOL embedded SQL statements is the keyword end-exec. This terminator delimits an embedded SQL statement from the statement that follows it in the file. The following is an example of a select statement embedded in a COBOL program.
Example: Terinator END-EXEC usage
EXEC SQL SELECT ename
        INTO :NAMEVAR
        FROM employee
    WHERE eno = :NUMVAR
        END-EXEC
You have the option of following the end-exec terminator with the COBOL separator period.
Example: Separator period usage
EXEC SQL SELECT ename
    INTO :NAMEVAR
    FROM employee
    WHERE eno = :NUMVAR
    END-EXEC.
In general, be sure to include the separator period wherever COBOL requires it for a normal COBOL statement (for example, at the end of a COBOL IF statement).
Do not use spaces between end-exec and the separator period. Certain considerations can arise with the way in which the preprocessor interprets the period. For details, see Preprocessor Operation in this chapter.
Last modified date: 08/28/2024