Generate DDL for a Db2 for z/OS database

Introduction

this page explains how to generate DDL for a Db2 z/OS database.

Extraction

CAST recommends the use of the RC/Migrator tool which is part of the CA Database Management Solution for Db2 for Z/OS, Version 19. There are no instructions provided for this. It can operate in batch mode (JCL Job executes Utility) or online mode.

Broadcom knowledge article describing DDL generation and “SQL only” output optionexternal link

Product documentation set for CA Database Management Solutions for Db2 for z/OS 19external link

CA RC/Migrator for Db2 for z/OS User Guideexternal link

You can also use the BMC Catalog Manager tool, which functions in batch mode (JCL Job executes Utility) or online mode.

You can use ADB2GEN moduleexternal link which is supplied by IBM. You should ignore storage options like tablespaces and storage groupe and also permissions, grant, mask.

You can also extract DDL using DBeaver : DBeaver Enterprise | Professional Database Managementexternal link, see how to set up and use DB2 with DBeaverexternal link.

Extraction example

With DBeaver you can generate SQL DDL from the Database Navigatorexternal link.

Check if your code is valid SQL

For example, the following is not valid SQL, it seems to be more Mainframe script:

Mainframe alike script - NOK

Create Table                 000038000
    ABC                     000039000
    (COL_D INT)             000039010
    ;                       000034000 

 The correct script should look like this :

SQL alike script - OK

Create Table                 
    ABC                     
    (COL_D INT)             
    ;                       

Generating XXL tablesize statistics

See SQL Analyzer - working with XXL or XXStables.