Creating a .DGE File

To run the Declaration Generator in batch mode, you must create a .DGE file specifying the tables for which you want declaration files generated, and the language(s) in which you want the declaration files written.

A .DGE file can be created in two ways:

The .DGE file must be stored in the DEFAULT APPLICATION PATH as specified in Options, PATHS tab, and it must have a .DGE extension.

A .DGE file contains the instructions needed to generate one or more declaration files. Each line in the file specifies a single "transaction," which creates a single declaration file in a single language (COBOL, C or PL/I). A transaction is specified as follows:

			tablename
			decFileName [option1
			option2
			option3...]

Where:

tablename specifies the name of the table for which a declaration file is generated. You can specify location and AuthID information using location.authid.tablename notation.

decFileName specifies the name of the file to which the declaration statements are written.

The option parameters specify the programming language, structure name and other parameters, if you don't want to use the defaults. See

DGE File Transaction Options

The following table describes the optional parameters you can include in a transaction statement. If an option is not included in a transaction statement, a default value is used.

Option Description Example
a=Case Where Case determines whether C element names are written in upper or lower case.

If Case is set to upper, element names are written in uppercase.

If Case is set to lower, or if this option is not set, element names are written in lowercase.

a=upper generates uppercase elements.
c=CompValue CompValue specifies the COMP type assigned to binary integers (for COBOL only; this option is ignored if language is set to C).

CompValue must be one of the following:

  • 0 - uses COMP
  • 4 - uses COMP-4
  • 5 - uses COMP-5
  • 0 (COMP) is the default.
c=4 assigns COMP-4 to binary integers.
d=DStuc Where DStruc determines whether a C structure is written as a variable declaration.

If DStruc is set to decl, the structure is declared as a variable.

If DStruc is set to nodecl, or if this option is not set, the C structure is defined as a data type, but is not declared as a variable.

d=decl creates a variable declaration from the structure.
g=PicType Where 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)
  • PICN is the default.
g=PICG declares graphic fields as follows:

PIC G(x) DISPLAY-1,

k=PageSize Where 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
  • 4K is the default.
k=32K assigns a 32k pages size to long variables.
l=Language Language specifies the language in which the declaration will be written. Language must be one of the following:
  • C
  • COBOL
  • COBOL is the default.
l=C generates a C header file.

l=COBOL generates a COBOL copybook.

p=Prefix Prefix specifies the prefix that will be affixed to each of the element names.

Depending upon the state of the u=Names option, this prefix will either be concatenated with a field name or a number to form an element name.

See u=Names, below.

p=sales- u=real

combines the prefix sales- with the field names to form element names such as sales-dept, sales-mgr, and so on.

p=sales- u=n/a

combines the prefix sales- with a three-digit number to form element names such as sales-001, sales-002, and so on.

s=Structure Structure specifies the name of the record definition (COBOL) or structure (C). This name must be valid for the chosen language.

If Structure is not specified, the following defaults are used:

  • For C: c_tablename
  • For COBOL: dcltablename
s=c_SalesReps assigns the name c_SalesReps to the generated structure
u=Names Where Names specifies whether field names or numbers are concatenated to Prefix to form element names (see p=Prefix, above).

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

If Names is set to n/a, or if this option is not set, numbers are concatenated to Prefix.

p=sales- u=real

combines prefix sales- with field names to form element names such as sales-dept,sales-mgr, and so on.

p=sales- u=n/a

combines the prefix sales- with a three-digit number to form element names such as sales-001, sales-002, and so on.

v=Level Where Level is an integer specifying the number to be assigned to the field-level definitions in a COBOL record description. v=3 writes level-3 field definitions, for example:
3 ST PIC X(2).
3 ZIP PIC X(5)