Running From the Command Line

You can create your declaration file without opening the Declaration Generator window. This is done by running the Declaration Generator and specifying its options from your Enterprise Developer command prompt.

To run the Declaration Generator from the Enterprise Developer command prompt, you call the dclg40n program using the following syntax:

dclg40n -tTableName [option1 option2 option3...]

where TableName specifies the name of the table for which a declaration file will be generated. Location and AuthID can be specified using location.authid.tablename notation.

The following table describes the command line options.

Option Description
-a Writes element names in a C structure in uppercase. If -a is not specified, element names are written in lowercase.
-cCompValue CompValue specifies the computation type assigned to COBOL binary integers.

CompValue must be one of the following numeric values:

  • 0 - uses COMP
  • 4 - uses COMP-4
  • 5 - uses COMP-5

If this option is not included, 0 (COMP) is used.

-d Includes a variable declaration for the defined C structure. If -d is not specified, a C structure is defined, but it is not declared as a variable.
-fDecFileName DecFileName specifies the name of the file to which the Declaration Generator will write the declaration.

If you do not include this option, the source table name will be used as the declaration file name (with the extension .h for C, .cpy for COBOL, or .inc for PL//I).

If a path is not specified, the file is written to the directory specified in the application path. Do not include an extension with the file name.

If you specify a file name that already exists, and the -r option is not specified, the Declaration Generator will ask whether you want to replace or append to the file at run time. If -r is specified, the file will automatically be overwritten (see -r below).

-gPicType Pictype specifies the COBOL data type that will be used for graphic, vargraphic and long vargraphic fields.

Pictype must be one of the following:

  • PICN declares graphic fields as PIC N(x).
  • PICG declares graphic fields as PIC G(x) DISPLAY-1
  • PICX declares graphic fields as PIC X(x)

If this option is not included, PICN is used.

-h Opens the Declaration Generator help file.
-iIniFileName IniFileName specifies the disk, directory, filename and extension of the initialization file to be used.

If this option is not included, the XDB.INI file in the current working directory is used.

-kPageSize PageSize specifies the page size that will be assigned to COBOL declarations for long varchar, long vargraphic, and long varbinary fields.

PageSize must be one of the following:

  • 4k
  • 32k

If this option is not included, 4K is used.

-lLanguage Language specifies the language in which the Declaration Generator will write the declaration file.

Language must be one of the following:

  • C
  • COBOL
  • PLI

If this option is not included, COBOL is used.

-n Runs the Declaration Generator without stopping on errors or for user responses.
-pPrefix Prefix is a 1 - 27 character string to be prefixed to each field name to form an element name.

For example, if the option -pemp_ were used, the field names ssn and lname would become element names emp_ssn and emp_lname, respectively.

-r Automatically replaces a declaration file if it already exists. If -r is not specified, the program asks whether to replace or append to a file that already exists.
-sStructure Structure specifies the name to be assigned to the record definition (COBOL) or structure (C).

If this option is not included, the table name is assigned to the structure.

-uNames Specifies whether field names will be concatenated with the string specified by -pPrefix (above), or whether they will be replaced with numbers.

If Names is set to real, field names are concatenated to Prefix.

If Names is set to n/a, a 3-digit, sequential number is concatenated to prefix.

For example, if the option -ureal were used, field names would be concatenated with the string specified in -pPrefix.

If -psales- and -un/a were used, the prefix sales- would be combined with a three-digit number to form element names such as sales-001, sales-002, and so on.

-vLevel Level assigns a level number to a COBOL record description. If -v is not used, field-level definitions are set to 2.

Example Command Line

The following example shows the command line for a COBOL copybook created for an EMPLOYEE table on a Windows system.

dclg40n -ic:\xdb\xdb.ini -tinstall.employee -lcobol -femployee.cpy -sdclemployee -psales -ureal -c4 -v2

In this example, the Declaration Generator will assign the name dclemployee to the record definition, and will prefix each elementary item with the string sales. COMP-4 class will be assigned to int and smallint fields. Level 2 will be assigned to the field-level definitions.