Example

CREATE TABLE STAFF(ID INTEGER NOT NULL,
             NAME VARCHAR(10) NOT NULL, DEPT INTEGER NOT NULL,
             JOB VARCHAR(6) NOT NULL, YEARS INTEGER,
             SALARY FLOAT(8,2) NOT NULL,COMM FLOAT(8,2))

Micro Focus XDBC supports the creation of permanent base tables only. Tables contain one or more columns separated by commas, which must also be defined when you create the table. The query processor will store Data Definition Language (DDL) statements after a CREATE TABLE statement until the first non-DDL statement is encountered. It will then create the COBOL table.

Example:

SQL (/? for help) ==> CREATE TABLE staff (
SQL continued ======>     id INTEGER NOT NULL,
SQL continued ======>     name VARCHAR(10) NOT NULL,
SQL continued ======>     dept INTEGER NOT NULL,
SQL continued ======>     job VARCHAR(6) NOT NULL,
SQL continued ======>     years INTEGER
SQL continued ======> );
SQL (/? for help) ==> CREATE UNIQUE INDEX
SQL continued ======>     i_staff0
SQL continued ======> ON
SQL continued ======>     staff( id )
SQL continued ======> ;
SQL (/? for help) ==> INSERT INTO
SQL continued ======>     staff
SQL continued ======> VALUES (
SQL continued ======>   1, 'John Smith', 31, 'PGM', 1
SQL continued ======> );

After the insert, the table will be created in the first directory listed in your FILE_PREFIX configuration file variable. Here is the file description:

C:\MFDBC\mf_data>rebuild /n SYSTEM%STAFF
Micro Focus Net Express V5 File Management Utility
Version 5.100.0116 Copyright ©) 1984-2008 Micro Focus (IP) Limited.

        File                             :   SYSTEM%STAFF
        Organization                     :   Indexed
        Format                           :   IDX-3
        Recording Mode                   :   Fixed
        Compression                      :   N
        Maximum Record Length            :                34
        Minimum Record Length            :                34
        Index Node Size                  :              1024
        Number of data records           :                 1
        Data  Created With Extfh Version :             14712
        Index Created With Extfh Version :             14712
        Last  Updated With Extfh Version :             14712

        Key Description (where 'Start' is measured from offset 1):
          Key       Start     Length     Dupl     Key Comp   Sparse Char
            0           1          6        N
/n SYSTEM%STAFF