IBM AS/400 Frozen Dessert Maker User Manual


 
Using SQL Statements
A*****************************************************************
A* DESCRIPTION: This is the DDS for the physical file EMPMST. *
A* It contains one record format called EMPREC. *
A* This file contains one record for each employee *
A* of the company. *
A*****************************************************************
A*
A R EMPREC
A ENUM 5 0 TEXT('EMPLOYEE NUMBER')
A ENAME 20 TEXT('EMPLOYEE NAME')
A ETYPE 1 TEXT('EMPLOYEE TYPE')
A EDEPT 3 0 TEXT('EMPLOYEE DEPARTMENT')
A ENHRS 3 1 TEXT('EMPLOYEE NORMAL WEEK HOURS')
A K ENUM
Figure 29. DDS for EMPRPT
To create a program from this source use the CRTBNDRPG command, specifying
DFTACTGRP(*NO).
Using SQL Statements
The DB2 UDB for AS/400 database can be accessed from an ILE RPG program
by embedding SQL statements into your program source. Use the following rules to
enter your SQL statements:
Enter your SQL statements on the Calculation specification
Start your SQL statements using the delimiter /EXEC SQL in positions 7-15
(with the / in position 7)
You can start entering your SQL statements on the same line as the starting
delimiter
Use the continuation line delimiter (a + in position 7) to continue your state-
ments on any subsequent lines
Use the ending delimiter /END-EXEC in positions 7-15 (with the slash in posi-
tion 7) to signal the end of your SQL statements.
Note: SQL statements cannot go past position 80 in your program.
Figure 30 on page 56 shows an example of embedded SQL statements.
Chapter 5. Entering Source Statements 55