Comments
An asterisk (*) in column 1 or in the indicator area indicates a COBOL comment line.
You can place these comments in embedded SQL statements anywhere that blank lines are allowed, with the following exceptions:
• Between an embedded SQL/FORMS block-type statement, such as activate and unloadtable, and its associated block of code; begin and end delimit these blocks of code. Comment lines cannot appear between the statement and its section. The preprocessor interprets such comments as COBOL host code, which causes preprocessor syntax errors. For example, the following statement causes a syntax error on the COBOL comment:
EXEC FRS UNLOADTABLE empform employee
(:NAMEVAR = ename) END-EXEC
* Illegal comment before statement body
EXEC FRS BEGIN END-EXEC
* Comment legal here
EXEC FRS MESSAGE :NAMEVAR END-EXEC
EXEC FRS END END-EXEC.
• In statements that are made up of more than one compound statement. An example of such a statement is the display statement, which typically consists of the display clause, an initialize section, activate sections and a finalize section. It cannot have COBOL comments between any of the components. The preprocessor translates these comments as host code, which causes syntax errors on subsequent statement components.
Note that the preprocessor ignores comment lines between string literal continuation lines.
The preprocessor also treats as comments any line whose indicator area contains a slash (/) to indicate a new listing page or a D to indicate a conditional compilation line.
You can also use the SQL comment delimiter (--). The preprocessor considers everything between this delimiter and the end of the line as a comment. For example:
EXEC SQL DELETE -- Delete all employees
FROM employee
END-EXEC
Last modified date: 04/03/2024