The DB2® UDB
for iSeries® database can be accessed from an ILE RPG program by embedding
SQL statements into your program source. The syntax is shown in DB2 UDB for iSeries Syntax.
Use the following rules to enter SQL statements:
Enter SQL statements on a calculation specification.
Start the SQL statements using the delimiter /EXEC SQL in positions 7-15,
with the slash in position 7.
You can start entering SQL statements on the same line as the starting
delimiter.
Use the continuation line delimiter (+ in position 7) to continue
SQL statements on any subsequent lines.
SQL statements cannot go past position 80.
Use the ending delimiter /END-EXEC in positions 7-15 (with the slash in
column 7) to signal the end of the SQL statements. The ending delimiter goes
on a separate line.
You must enter a separate command to process the SQL
statements.
Note: SQL statements cannot be specified in the referred
source member of a /COPY statement.
Refer to the IBM® i
Information Center database and file systems category for the descriptions
of how to code SQL statements.