Generating declarations
Use the Declarations Generator to generate language-specific
DECLARE TABLE and DECLARE VIEW statements for C, COBOL, and PL/I
programs. This wizard calls the DCLGEN command to generate these statements,
generate corresponding host variable structures, and place these table and view declarations into a
member of a partitioned data set that you can include in a program.
Prerequisites
DCLGEN command and the Declarations Generator require
the following software levels and components:- Db2 13 for z/OS or Db2 12 for z/OS with APAR PH28863/PTF UI74277.
- Installation of Db2-supplied routines using DSNTIJRT.
- A WLM-established stored procedures address space and authorization for the ADMIN_COMMAND_DSN stored procedure, as described in ADMIN_COMMAND_DSN stored procedure.
- You must be connected to the target MVS subsystem in the Remote Systems view.
Launching and using the Declarations Generator
- In the Catalog folder of a Db2 for z/O2 database connection, select a table or view.

- Right-click and select Generate Declarations (DCLGEN). The Declaration Generator opens.
-
Use the options page of the wizard to specify the output language for the declaration, the z/OS system, partitioned data set, and member name for the generated file, and the data structure name and field names prefix for the declaration.
Language: Choose the source programming language. The DCLGEN command supports C, C++, COBOL, and PL/I.
Output System: Select a z/OS system. If you are not already connected to the chosen system, the Connect button is activated so that you can connect.
Output data set: Specify a fully-qualified partitioned data set name to contain the generated include file. You can either type a file name or click Select to search the z/OS system for a partitioned data set. If you type a file name, the data set must already be allocated on the z/OS system.
Member: Specify a member name. The wizard can suggest a member name derived from the name of the table or view.
Password: Enter a password for the file, if needed.
Data structure name: Specify a data structure name for the generated data declaration. The wizard can suggest a name derived from the name of the table or view. The name can have up to 31 characters. If the data structure name is a single-byte or mixed string and the first character is not alphabetic, it must be enclosed in apostrophes.
Field names prefix: The prefix can have up to 28 characters. If the prefix is a single-byte or mixed string and the first character is not alphabetic, it must be enclosed in apostrophes.
For more information about the options you can specify on this page, see DCLGEN (declarations generator) subcommand (DSN).
- To specify additional options for the declaration, click Next.
- Click Finish.
- The wizard generates a
DECLARE TABLEstatement and data declaration and saves it in the specified partitioned data set member.