You can use COBSQL to access the SQL functions offered by the Oracle Database Management Systems (DBMS) by embedding SQL statements within your COBOL program in the form:
EXEC SQL SQL statement END-EXEC
and then using the Oracle precompiler to process the embedded SQL before passing the program to the COBOL Compiler. The database precompiler replaces embedded SQL statements with the appropriate calls to database services. Other additions are made to the source code to bind COBOL host variables to the SQL variable names known to the database system.
The advantage of embedding SQL in this way is that you do not need to know the format of individual database routine calls. The disadvantage is that the source code that you see when you debug your program is that output by the precompiler and not the original embedded SQL. You can overcome this disadvantage by using COBSQL.
COBSQL provides an integrated interface between Micro Focus COBOL and the third-party standalone precompiler, enabling you to debug a program containing EXEC SQL statements and display your original source code rather than the code produced by the precompiler.
To access a DBMS from COBOL under UNIX, the COBOL run-time system needs to be aware of the API routines used by the DBMS. A database vendor might provide a script that creates either:
The script contains a cob command, and you can control the effect of the script by amending the options to the cob command. See cob (cob32 or cob64) Command for more information.