156 DB2 Universal Database for iSeries Administration: The Graphical Way on V5R3
To generate the SQL statements of a group of objects to a source physical file on the iSeries
server, follow these steps:
1. Click Databases and the database that you want to work with.
2. Click Schemas and the schema that you want.
3. Select File
Generate SQL to view the Generate SQL window (see Figure 6-16). This is
another way to generate SQL for a group of objects.
Figure 6-16 Selecting Generate SQL from the File menu
Important: After the statements are generated, you can edit them to create a new copy in
another schema and optionally saved them, or you can run them using the SQL Script
facility. If you select multiple objects to be SQL Generated, you have the option to run one,
some, or all of the statements after any required editing.
Chapter 6. Reverse engineering and Generate SQL 157
4. In the Generate SQL window (Figure 6-17), complete these tasks:
a. In the Output tab, select the Write to file option.
b. For File Type, select Database source file.
c. For Schema, select the schema that you want, which is QGPL in our case.
d. Type the file name and the member.
e. Click the Generate button to start the Generate SQL process on the iSeries server.
Figure 6-17 Starting the Generate SQL process on the iSeries server
Note: For existing files, the option to append to the file is provided. If an existing file is
selected, and the append option is not chosen, you are asked if you want to overwrite
the existing file.
158 DB2 Universal Database for iSeries Administration: The Graphical Way on V5R3
5. In the iSeries Navigator window (Figure 6-18), double-click the GENSQL043 file, in this
case, to see the script.
Figure 6-18 Selecting the source physical file to show the Generate SQL Script
Chapter 6. Reverse engineering and Generate SQL 159
6. The script appears as shown in Figure 6-19. Expand the window and use the scroll bar to
explore the script file.
Figure 6-19 Exploring the SQL Script file from Operations Navigator
160 DB2 Universal Database for iSeries Administration: The Graphical Way on V5R3
6.2.2 Generating SQL from the Database Navigator map
You can generate the SQL DDL statement from some or all objects in a map generated by the
Database Navigator feature (see Chapter 5, “Database Navigator maps” on page 111).
1. Click the Database Navigator icon to display the maps on the right that exist on the iSeries
server. See Figure 6-20.
2. Double-click to open the database map that you created.
Figure 6-20 Opening the Database Navigator map

Get DB2 Universal Database for iSeries Administration: The Graphical Way on V5R3 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.