/dds-to-ddl

Convert a DDS file into SQL Table and creates surrogate files.

GNU General Public License v3.0GPL-3.0

dds-to-ddl

Convert a DDS file into SQL Table and creates surrogate files.

It won't be 100% all of the time, but should get you 80% of the way there 80% of the time. This is intended to be a helper, not a flawless converter that you mindlessly run. Do not use this if you don't know what you're doing.

Usage

  1. Clone the repo

    • git clone https://github.com/oceanskunk/dds-to-ddl.git
  2. Compile the programs

    • CRTSQLRPGI OBJ(<your library>/CVTDDS) SRCSTMF('/home/<USER>/dds-to-ddl/qrpglesrc/CVTDDS.SQLRPGLE')
    • CRTSQLRPGI OBJ(<your library>/CRTDDS) SRCSTMF('/home/<USER>/dds-to-ddl/qrpglesrc/CRTDDS.SQLRPGLE')
  3. Call CVTDDS first

    • CALL PGM(CVTDDS) PARM('LIBRARY' 'FILENAME' 'SQLTABLE')
      • LIBRARY and FILENAME should point to the existing PF
      • SQLTABLE is the name for the new SQL table
    • This will generate DDL for your new SQL table.
    • Review the source in QTEMP/QSQLSRC.
    • RUNSQLSTM to create the new table.
  4. Call CRTDDS next

    • CALL PGM(CRTDDS) PARM('LIBRARY' 'FILENAME' 'SQLTABLE')
      • LIBRARY and FILENAME should point to the existing PF
      • SQLTABLE is the name for the new SQL table
    • This will generate DDS for new versions of the existing files.
    • The PF will be converted into a LF.
    • All existing LFs will be based on the new SQL table.
    • Review all the source in QTEMP/QSQLSRC (yes, the DDS is in QSQLSRC).

DO NOT COMPILE ANYTHING YET

  1. Copy your data from the PF into the new table

    • You will need *MAP *DROP
  2. Now you can compile the DDS

Limitations

  • Does not handle multi-format files.
  • Does not (yet) handle select/omit.
  • Probably many others...