Generate DDS or / and DDL for a Db2 for i database
Introduction
this page explains how to generate DDS or / and DDL for a Db2 for i database.
Extraction
Usually DDS files are provided to create Table/Unique Key/View declared in physical/logical files. In order to extract and deliver them, you should refer to source code delivery instructions for the DDS files IBM RPG Analyzer extension.
If you need to extract DDL, you can use SQL commands, IBM i Navigator, or system commands / catalog queries.
GENERATE_SQL procedure generates the SQL data definition language statements required to recreate a database object . All details about GENERATE_SQL procedure
You can typically run it for a schema and include dependent objects (indexes, constraints, views, etc.) using the appropriate options/parameters :
CALL QSYS2.GENERATE_SQL(
OBJECT_SCHEMA => 'MYLIB',
OBJECT_TYPE => 'SCHEMA',
SQL_FILE_NAME => '/tmp/MYLIB_schema.sql',
SQL_FILE_CCSID => 1208
);