Comments
Embedded SQL/Pascal comments can be either of the two standard Pascal comments, delimited by "(*" and "*)" or by "{" and "}". For example:
exec frs message 'No permission ...';(*No user access *)
exec frs sleep 2; { Let the user read it }
Note that you cannot mix delimiters: a comment starting with "{" must end with "}" and not with "*)". You cannot nest comments, but you can extend them over multiple lines. As a convention, comments in this document will normally be delimited by "{" and "}".
You can include an Embedded SQL/Pascal comment anywhere in an Embedded SQL statement that a blank is allowed, with the following exceptions:
• Between the margin and the word exec (whether or not you have a Pascal label prefix).
• Between the word exec and the word sql or frs. In the following example, comments cause both statements to be interpreted as Pascal host code:
{ Initial comment } exec sql include sqlca;
exec { Between } sql help employee;
• Between words that are reserved when they appear together. For a list of these double reserved words, see the list of Embedded SQL keywords in the SQL Reference Guide.
• In string constants.
• 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.
• 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 would interpret such comments as Pascal host code and generate preprocessor syntax errors. (Note, however, that comments can appear on the same line as the statement.) For example, the following statement would cause a syntax error on the Pascal comment:
exec frs unloadtable empform
employee (:namevar = ename);
{Illegal comment before statement body}
exec frs begin; {Comment legal here}
msgbug := namevar;
exec frs end;
• Statements made up of more than one compound statement, such as the display statement, which typically consists of the display clause, an initialize section, activate sections and a finalize section, cannot have Pascal comments between any of the components. These comments would be translated as host code and would cause syntax errors on subsequent statement components.
You can also use the SQL comment delimiter "--". Everything between this delimiter and the end of the line is considered a comment. For example:
exec sql delete -- Delete all employees
from employee;
Note: Because Pascal assumes that "(*" is the beginning of a comment, when you want to use the aggregate function, count, to count the number of rows in a table, that is count (*), you must put a space between the left parenthesis and the asterisk, count ( *).
Last modified date: 08/14/2024