Application Development Guide
Embedded SQL statements consist of the following three elements:
- Element
- Correct FORTRAN Syntax
- Keyword
- EXEC SQL
- Statement string
- Any valid SQL statement with blanks as delimiters
- Statement terminator
- End of source line.
The end of the source line serves as the statement terminator. If
the line is continued, the statement terminator is the end of the last
continued line.
For example:
EXEC SQL SELECT COL INTO :hostvar FROM TABLE
The following rules apply to embedded SQL statements:
- Code SQL statements between columns 7 and 72 only.
- Use full-line FORTRAN comments, or SQL comments, but do not use the
FORTRAN end-of-line comment '!' character in SQL
statements. This comment character may be used elsewhere, including
host variable declarations.
- Use blanks as delimiters when coding embedded SQL statements, even though
FORTRAN statements do not require blanks as delimiters.
- Use only one SQL statement for each FORTRAN source line. Normal
FORTRAN continuation rules apply for statements that require more than one
source line. Do not split the EXEC SQL keyword pair between
lines.
- SQL comments are allowed on any line that is part of an embedded SQL
statement. These comments are not allowed in dynamically executed
statements. The format for an SQL comment is a double dash
(--) followed by a string of zero or more characters
and terminated by a line end.
- FORTRAN comments are allowed almost anywhere within an embedded
SQL statement. The exceptions are:
- Comments are not allowed between EXEC and SQL.
- Comments are not allowed in dynamically executed statements.
- The extension of using ! to code a FORTRAN comment at the
end of a line is not supported within an embedded SQL statement.
- Use exponential notation when specifying a real constant in SQL
statements. The database manager interprets a string of digits with a
decimal point in an SQL statement as a decimal constant, not a real
constant.
- Statement numbers are invalid on SQL statements that precede the first
executable FORTRAN statement. If an SQL statement has a statement
number associated with it, the precompiler generates a labeled CONTINUE
statement that directly precedes the SQL statement.
- Use host variables exactly as declared when referencing host variables
within an SQL statement.
- Substitution of white space characters such as end-of-line and TAB
characters occur as follows:
- When they occur outside quotation marks (but inside SQL statements),
end-of-lines and TABs are substituted by a single space.
- When they occur inside quotation marks, the end-of-line characters
disappear, provided the string is continued properly for a FORTRAN
program. TABs are not modified.
Note that the actual characters used for end-of-line and TAB vary from
platform to platform. For example, OS/2 uses Carriage Return/Line Feed
for end-of-line, whereas UNIX-based systems use just a Line Feed.
[ Top of Page | Previous Page | Next Page ]