Generates declarations for a specified database table,
eliminating the need to look up those declarations in the documentation.
The generated declarations can be modified as necessary. The supported
host languages are C/C++, COBOL, JAVA, and FORTRAN.
Command syntax
>>-db2dclgn-- -d--database-name-- -t--table-name---------------->
.------------.
V |
>----+--------+-+----------------------------------------------><
'-option-'
Command parameters
- -d database-name
- Specifies the name of the database to which a connection is to
be established.
- -t table-name
- Specifies the name of the table from which column information
is to be retrieved to generate declarations.
- option
- One or more of the following options:
- -a action
- Specifies whether declarations are to be added or replaced. Valid
values are ADD and REPLACE. The
default value is ADD.
- -b lob-var-type
- Specifies the type of variable to be generated for a LOB column.
Valid values are:
- LOB (default)
- For example, in C, SQL TYPE is CLOB(5K) x.
- LOCATOR
- For example, in C, SQL TYPE is CLOB_LOCATOR x.
- FILE
- For example, in C, SQL TYPE is CLOB_FILE x.
- -c
- Specifies whether the column name is to be used as a suffix in
the field name when a prefix (-n) is specified.
If no prefix is specified, this option is ignored. The default behavior
is to not use the column name as a suffix, but instead to use the
column number, which starts at 1.
- -i
- Specifies whether indicator variables are to be generated. Since
host structures are supported in C and COBOL, an indicator table of
size equal to the number of columns is generated, whereas for JAVA
and FORTRAN, individual indicator variables are generated for each
column. The names of the indicator table and the variable are the
same as the table name and the column name, prefixed
by "IND-" (for COBOL) or "ind_" (for the other languages). The default
behavior is to not generate indicator variables.
- -l language
- Specifies the host language in which the declarations are to be
generated. Valid values are C, COBOL, JAVA, and FORTRAN. The default
behavior is to generate C declarations, which are
also valid for C++.
- -n name
- Specifies a prefix for each of the field names. A prefix must
be specified if the -c option is used. If it
is not specified, the column name is used as the field name.
- -o output-file
- Specifies the name of the output file for the declarations. The
default behavior is to use the table name as the base file name, with
an extension that reflects the generated host language:
.h for C
.cbl for COBOL
.java for JAVA
.f for FORTRAN (UNIX)
.for for FORTRAN (INTEL)
- -p password
- Specifies the password to be used to connect to the database.
It must be specified if a user ID is specified. The default behavior
is to provide no password when establishing a connection.
- -r remarks
- Specifies whether column remarks, if available, are to be used
as comments in the declarations, to provide more detailed descriptions
of the fields.
- -s structure-name
- Specifies the structure name that is to be generated to group
all the fields in the declarations. The default behavior is to use
the unqualified table name.
- -u userid
- Specifies the user ID to be used to connect to the database. It
must be specified if a password is specified. The default behavior
is to provide no user ID when establishing a connection.
- -v
- Specifies whether the status (for example, the connection status)
of the utility is to be displayed. The default behavior is to display
only error messages.
- -w DBCS-var-type
- Specifies whether sqldbchar or wchar_t is to be used for a GRAPHIC, VARGRAPHIC, or DBCLOB column in C.
- -y DBCS-symbol
- Specifies whether G or N is
to be used as the DBCS symbol in COBOL.
- -z encoding
- Specifies the encoding the coding convention in accordance to
the particular server. Encoding can be either LUW or OS390. If OS390 is specified,
the generated file would look identical to a file generated by OS/390®.
Examples
db2dclgn -d sample -t emp_resume -l cobol -a replace