Accessing Databases from COBOL

Describes the approaches we provide for accessing databases from COBOL.
We provide several approaches to accessing a database from a COBOL program that contains embedded SQL statements:
DBMS vendor pre-compiler technology
These pre-compilers take the COBOL source file as input, and then generates an output file that is compiled by the Micro Focus COBOL compiler. The pros and cons of this approach include:
  • A DBMS pre-compiler can offer better performance over Micro Focus ECM technology such as OpenESQL, but this is typically insignificant.
  • A DBMS pre-compiler enables the use of DBMS vendor extensions outside of the ANSI specification.
  • Compilation is a two-stage process: Pre-compilation followed by COBOL compilation.
  • Debugging is not integrated, meaning that you must debug pre-compiler output and not the original SQL embedded in the COBOL.
  • Pre-compilers do not currently support JVM managed code.
  • Pre-compilers do not support CHARSET(EBCDIC).
Micro Focus COBSQL technology
Micro Focus provides COBSQL technology that you can use with a DBMS pre-compiler to significantly improve integration between the pre-compiler and the COBOL compiler. For example, COBSQL enables you to debug the original SQL statements rather than source code generated by the pre-compiler. In addition, COBSQL supports CHARSET(EBCDIC).
Micro Focus External Compiler Module (ECM) technology for OpenESQL
OpenESQL provides ubiquitous database access. No DBMS vendor pre-compiler is required. The pros and cons of this approach include:
  • OpenESQL is database-agnostic, providing ODBC or JDBC connectivity within the confines of their corresponding APIs. This means that COBOL programs using OpenESQL can usually be switched to access a new database with minimal code change.
  • OpenESQL is currently the only technology that enables JDBC access by COBOL programs using embedded SQL.
  • OpenESQL performance could be slightly degraded over DMBS vendor pre-compilers, but this is typically insignificant.
  • By design, OpenESQL supports embedded SQL based on ANSI SQL standards.
  • OpenESQL might not support all of the extensions to the ANSI standard that some DBMS vendors provide.
Micro Focus External Compiler Module (ECM) technology for DB2 ECM
DB2 ECM provides database access to DB2 LUW and mainframe DB2, just like the IBM pre-compiler environment for COBOL. The DB2 ECM supports the following, providing advantages over DBMS vendor pre-compilers:
  • DSNTIAR and remapping SQLCODEs
  • COMP host variables