COBOL with DB2 and Embedded SQL to Java

SoftwareMining's automated, rule-based COBOL-to-Java and COBOL-to-C# Conversion Toolkit converts enterprise COBOL applications that access DB2 through embedded EXEC SQL into maintainable Java or C# source code. It translates SQL statements, host variables, null indicators, cursors, SQLCODE handling and transaction processing together with the surrounding COBOL business logic.

The generated application uses standard Java or .NET database-access technologies and SoftwareMining runtime components where COBOL or DB2 behaviour must be preserved. Applications can continue to use DB2 or be adapted for another relational database, subject to differences in SQL syntax, data types and database behaviour.

Database connections, transaction boundaries and connection pooling can be configured for the target application architecture. The resulting application can be deployed on cloud, private-cloud or on-premises infrastructure without requiring the application and database to reside on the same system.


Example of COBOL EXEC SQL Translation

This example compares COBOL with embedded EXEC SQL on the left with the corresponding Java generated by SoftwareMining on the right. It demonstrates input and output host variables, null-indicator handling and SQLCODE processing.

EXEC SQL
  SELECT CUSTOMER_NAME
    INTO :CUSTOMER-NAME
     :NULL-INDICATOR-1
    FROM CUSTOMER
   WHERE CUSTOMER_ID =  :CUSTOMER-ID
END-EXEC


IF SQLCODE NE 0
   ...
   
sqlProcessor.prepare("SELECT CUSTOMER_NAME "
  + "FROM CUSTOMER "
  + "WHERE CUSTOMER_ID = ? ");

sqlProcessor.setOutParameter(1,customer.getCustomerName()
                              , customer.getNullIndicator1());
sqlProcessor.setInParameter (1, customer.getCustomerId());
sqlProcessor.executeQuery();
sqlProcessor.next();

if (sqlca.getSqlcode() != 0) {  ... }
 

SoftwareMining generates the parameter binding, field access, null-indicator handling and database-access code according to the generated Java or C# data structures and target database configuration.

How SoftwareMining Translates COBOL EXEC SQL