Comments
You can use the following characters in column 1 to indicate that a line is a comment:
• The letter "C"
• The asterisk (*)
• The lower case letter "c" (VMS and Windows)
• The exclamation point (!) (VMS and Windows)
The following example illustrates the correct use of the "C" comment delimiter:
exec sql select ename
1 into :namvar
2 from employee
C Confirm that "eno" is the same as the current
C value chosen
3 where eno = :curval
VMS:
The exclamation point can also be used anywhere on the statement line to mark a comment that extends to the end of the line as in the following example. However, this type of comment line cannot be continued over multiple lines:
exec sql delete from employee !Delete all employees
A comment line can appear anywhere in an Embedded SQL program that a blank line is allowed, with the following exceptions:
• In string constants. The preprocessor interprets such a comment as part of the string constant.
• Between component lines of Embedded SQL/FORMS block-type statements. All block-type statements (such as activate and unloadtable) are compound statements that include a statement section delimited by begin and end. Comment lines must not appear between the statement and its section. The preprocessor interprets such comments as Fortran host code, causing preprocessor syntax errors. For example, the following statement causes a syntax error on the first comment:
exec frs unloadtable empform
employee (:namvar = ename)
C Illegal comment before statement body.
exec frs begin
C Comment legal here
exec frs message :namvar
exec frs end
VMS: You could also use an exclamation point on the following line with the C comment. For example:
C Comment legal here
exec frs message :namvar !And legal here too
• An example of a compound statement is the display statement, which typically consists of the display clause, an initialize section, activate sections, and a finalize section. The preprocessor translates these comments as host code, which causes syntax errors on subsequent statement components.
• In parts of statements that are dynamically defined. For example, a comment in a string variable specifying a form name is interpreted as part of the form name.
The SQL comment delimiter (--) indicates that the remainder of the line is a comment. In-line comments are not propagated to the host language file.
Last modified date: 08/28/2024