DCLGEN
A tool that generates COBOL declarations matching a DB2 table, so the program's fields line up with the columns.
Also written declarations generator
DCLGEN, declarations generator, reads a table's definition from the DB2 catalogue and produces the COBOL source needed to work with it: a declaration of the table and a matching structure of host variables with the right types and lengths.
It exists to remove a whole category of error. Writing those declarations by hand means matching every column's type and length exactly, and getting one wrong produces either a bind failure or, worse, data that is silently truncated or misinterpreted. Generating them from the real definition means they cannot drift from the table.
The output is stored as a copybook and included into programs, so many programs share one accurate declaration.
When a table changes, DCLGEN is run again and the copybook is replaced, then the programs using it are recompiled and rebound. That sequence is a standard part of impact analysis for a database change.
It is a small tool, but a good early habit: generate the declarations rather than typing them.
Related terms
- Embedded SQLSQL statements written directly inside a COBOL program, marked off so they can be prepared before compiling.
- CopybookA shared block of COBOL declarations kept in a library and included into programs, so a record layout is defined once.
- DB2 for z/OSIBM's relational database on the mainframe, where a great deal of the world's banking and insurance data is stored.
- COBOLThe programming language most business logic on the mainframe is written in. Verbose by design, and still running the world's payments.
- BINDPreparing a program's SQL for execution, working out how each statement will access the data and storing the result.