Was this helpful?
Labels
Embedded SQL statements can have a label prefix. The embedded SQL label is equivalent to a COBOL paragraph name. The label must begin with an alphanumeric character, which can be followed by alphanumeric characters, hyphens, and underscores.
Windows and UNIX:
The label must be the first word on the line. It must start in column 8 or beyond, or be preceded by a tab, and it must be terminated with a period.
VMS:
The label must be the first word on the line (optionally preceded by white space) and must be terminated with a period.
Example: Label usage
CLOSE-CURSOR1. EXEC SQL CLOSE cursor1 END-EXEC.
The label can appear anywhere a COBOL paragraph name can appear. Even though the preprocessor accepts it in front of any exec sql or exec frs prefix, it may not be appropriate to code it on some lines. For example, although the preprocessor accepts the following code, the code will cause a compiler error later if it is in the Data Division:
INCL-SQLCA. EXEC SQL INCLUDE SQLCA END-EXEC.
As a general rule, use labels only with executable statements in the Procedure Division.
Last modified date: 08/28/2024