MDCLGEN command-line tool

Note: This topic applies to Windows environments only.

MDCLGEN is a batch tool alternative to generating copybooks and include files using the OpenESQL Assistant. For the most part, MDCLGEN generates code using the current options set for the OpenESQL Assistant; however, you can override certain default settings via command-line parameters.

Syntax

MDCLGEN mode=ODBC; db=dsn; tbl=table-name; file=cpy-filename; 
   [u=user-id;] [p=password;] [typevar={STD | SQL}]; [case={U | L | ASIS};] 
   [schema=schema-name;] [sjis={T | F};}

Parameters

Required parameters
The following parameters are required at the command line regardless of the settings in OpenESQL Assistant options.
mode=ODBC
The type of code to generate. MDCLGEN supports ODBC only.
db=dsn
The cataloged data source name.
tbl=table-name
The name of the table from which to generate the copybook.
Note: When running in ODBC mode, table names might be case sensitive; therefore, best practice is to match the case you use for table-name to the case used in the name of the actual table.
file=cpy-filename
The name of the generated copybook.
Optional override parameters
The following parameters are not required at the command line, and default to the settings specified in the OpenESQL Assistant options. However, you can specify one or more of these parameters with MDCLGEN to override default settings:
u=user-id
The user ID needed to log into the specified database. Required only when credentials are required by the database. Equivalent OpenESQL Assistant option is User name.
p=password
The password needed to log into the specified database. Required only when credentials are required by the database. Equivalent OpenESQL Assistant option is Password.
typevar={STD | SQL}
The Type COBOL variables to generate:
STD Standard Type COBOL Type variables. Default setting.
SQL Enables the OpenESQL preprocessor to better determine host variable usage
Equivalent OpenESQL Assistant option is Type COBOL variable.
case={U | L | ASIS}
The case to use for characters in generated copybooks:
U Uppercase
L Lowercase
ASIS A combination of upper and lower case as found in the specified table. Default setting.
Equivalent OpenESQL Assistant option is Generate code.
Optional parameters
The following optional parameters have no equivalent in OpenESQL Assistant:
schema=schema-name
The schema name for the specified table. Required only when multiple schemas exist for same table. No default setting.
Note: When running in ODBC mode, schema names might be case sensitive; therefore, best practice is to match the case you use for schema-name to the case used in the name of the actual schema.
sjis={T | F}
When set to T, the copybook is saved as an SJIS file. The default is F.

Example

MDCLGEN command line:
MDCLGEN mode=odbc; db=sample; tbl=EMPLOYEE; file=employee.cpy; typevar=sql;
Generated employee.cpy copybook:
      *> -------------------------------------------
      *> DECLARE TABLE for EMPLOYEE
      *> -------------------------------------------
           EXEC SQL DECLARE EMPLOYEE TABLE 
           ( EMPNO                CHAR(6)      NOT NULL
           , FIRSTNME             VARCHAR(12)  NOT NULL
           , MIDINIT              CHAR(1)
           , LASTNAME             VARCHAR(15)  NOT NULL
           , WORKDEPT             CHAR(3)
           , PHONENO              CHAR(4)
           , HIREDATE             DATE
           , JOB                  CHAR(8)
           , EDLEVEL              SMALLINT     NOT NULL
           , SEX                  CHAR(1)
           , BIRTHDATE            DATE
           , SALARY               DECIMAL(9,2)
           , BONUS                DECIMAL(9,2)
           , COMM                 DECIMAL(9,2)
           ) END-EXEC.
      *> -------------------------------------------
      *> COBOL HOST VARIABLES FOR TABLE EMPLOYEE
      *> -------------------------------------------
       01  DCLEMPLOYEE.
           03 EMPLOYEE-EMPNO                  SQL TYPE IS
                                              CHAR(6).
           03 EMPLOYEE-FIRSTNME               SQL TYPE IS
                                              CHAR-VARYING(12).
           03 EMPLOYEE-MIDINIT                SQL TYPE IS
                                              CHAR(1).
           03 EMPLOYEE-LASTNAME               SQL TYPE IS
                                              CHAR-VARYING(15).
           03 EMPLOYEE-WORKDEPT               SQL TYPE IS
                                              CHAR(3).
           03 EMPLOYEE-PHONENO                SQL TYPE IS
                                              CHAR(4).
           03 EMPLOYEE-HIREDATE               SQL TYPE IS DATE.
           03 EMPLOYEE-JOB                    SQL TYPE IS
                                              CHAR(8).
           03 EMPLOYEE-EDLEVEL                PIC S9(04)  COMP-5.
           03 EMPLOYEE-SEX                    SQL TYPE IS
                                              CHAR(1).
           03 EMPLOYEE-BIRTHDATE              SQL TYPE IS DATE.
           03 EMPLOYEE-SALARY                 PIC S9(7)V9(2)  COMP-3.
           03 EMPLOYEE-BONUS                  PIC S9(7)V9(2)  COMP-3.
           03 EMPLOYEE-COMM                   PIC S9(7)V9(2)  COMP-3.
      *> -------------------------------------------
      *> COBOL INDICATOR VARIABLES FOR TABLE EMPLOYEE
      *> -------------------------------------------
       01  DCLEMPLOYEE-NULL.
           03 EMPLOYEE-MIDINIT-NULL           PIC S9(04)  COMP-5.
           03 EMPLOYEE-WORKDEPT-NULL          PIC S9(04)  COMP-5.
           03 EMPLOYEE-PHONENO-NULL           PIC S9(04)  COMP-5.
           03 EMPLOYEE-HIREDATE-NULL          PIC S9(04)  COMP-5.
           03 EMPLOYEE-JOB-NULL               PIC S9(04)  COMP-5.
           03 EMPLOYEE-SEX-NULL               PIC S9(04)  COMP-5.
           03 EMPLOYEE-BIRTHDATE-NULL         PIC S9(04)  COMP-5.
           03 EMPLOYEE-SALARY-NULL            PIC S9(04)  COMP-5.
           03 EMPLOYEE-BONUS-NULL             PIC S9(04)  COMP-5.
           03 EMPLOYEE-COMM-NULL              PIC S9(04)  COMP-5.