COBOL to SQL Data Type Mapping

SQL has a standard set of data types, but the exact implementation of these varies between databases, and many databases do not implement the full set.

Within a program, COBOL host variable declarations can serve both as COBOL host variables and as SQL database variables. To make this possible, the preprocessor converts COBOL data types to their equivalent SQL data types. We sometimes refer to this conversion process as mapping COBOL data types to SQL data types. The preprocessor looks for specific COBOL picture clause formats that identify those that require mapping to SQL data types. For mapping to be successful, you must declare your COBOL host variables using these specific COBOL picture clauses.

We provide SQL data types for the OpenESQL and DB2 ECM preprocessors. For complete information on each SQL data type and its required COBOL host variable formats, see the SQL Data Types and SQL/COBOL Data Type Mappings Reference topics.

Note: For information on the appropriate host variable formats to use with the COBSQL preprocessor, see your DBMS documentation.