Convert Your COBOL Db2 Programs to Java Without Rebinding

As most Db2 developers and DBAs know, when you modify a Db2 program you have to prepare the program to enable it to be executed. This program preparation process requires running a series of code preprocessors that—when enacted in the proper sequence—creates an executable load module and a Db2 application package. The combination of the executable load module and the application package is required before any Db2 program can be run, whether batch or online.

But it is not our intent here to walk through and explain all of the steps and nuances involved in Db2 program preparation. Instead, we are taking a look at the impact of converting COBOL programs to Java programs, particularly when it comes to the need to bind as a part of the process.

We all know that issuing the BIND command causes Db2 to formulate access paths for SQL. If enough things (statistics, memory, buffers, etc.) have changed, then access paths can change whenever you BIND or REBIND. And this can be troublesome to manage.

But if the SQL does not change, then it is not technically necessary to bind to create a new package. You can prevent unnecessary BIND operations by comparing the new DBRM from the pre-compile with the previous version. Of course, there is no native capability in Db2 or the BIND command to compare the DBRM. That is why there are third-party tools on the market that can be used for this purpose.

But again, it is not the purpose of today’s post to discuss such tools. Instead, the topic is converting COBOL to Java. I have discussed this previously in my blog in the post Consider Cross-Compiling COBOL to Java to Reduce Costs, so you might want to take a moment to read through that post to acquaint yourself with the general topic.

Converting COBOL to Java and BIND

So, let’s consider a COBOL program with Db2 SQL statements in it. Most COBOL uses static SQL, meaning that the access paths are determined at bind time, not at execution time. If we convert that COBOL program to Java then we are not changing the SQL, just the code around it. Since the SQL does not change, then a bind should not be required, at least in theory, right?

Well, we first need to get into a quick discussion about types of Java programs. You can use either JDBC or SQLJ for accessing Db2 data from a Java program. With JDBC the program will use dynamic SQL whereas SQLJ will deliver static SQL. The Db2 BIND command can be issued using a DBRM (precompiler output) or a SQLJ customized profile. 

So, part of the equation to avoid binding is to utilize SQLJ for converted COBOL programs.

CloudFrame, the company and product discussed in the referenced blog post above can be used to convert COBOL programs into modular Java. And it uses SQLJ for the Db2 access. As such, with embedded SQLJ, static SQL will be used and the access paths will be determined at bind time instead of execution time.

But remember, we converted business logic, not SQL. The same SQL statements that were used in the COBOL program can be used in the converted Java. CloudFrame takes advantage of this and re-purposes the existing package from the previous COBOL program to the new Java SQLJ. CloudFrame automates the entire process as part of the conversion from COBOL to Java. This means that the static SQL from the COBOL program is converted and customized into SQLJ in java. This is a built-in capability of CloudFrame that allows you to simply reuse the same package information that was already generated and bound earlier.

This means no bind is required when you use CloudFrame to convert your Db2 COBOL applications to Java… and no access paths will change. And that is a good thing, right? Conversion and migration are already time-consuming processes; eliminating performance problems due to changing access paths means that one less issue to worry about during a COBOL to Java conversion when you use CloudFrame.

要查看或添加评论,请登录

Craig Mullins的更多文章

  • Data Governance for DBAs

    Data Governance for DBAs

    Today, the role of the Database Administrator (DBA) has evolved beyond the traditional responsibilities of maintaining…

    5 条评论
  • Intelligent Automation of Db2 Administration and Management

    Intelligent Automation of Db2 Administration and Management

    It is vitally important to ensure that your Db2 databases and systems are running effectively and efficiently. And this…

    4 条评论
  • Hey! Have You Heard About Ancelus?

    Hey! Have You Heard About Ancelus?

    Ancelus is a patented ACID-compliant database system that replaces pre-defined storage structures with an algorithmic…

  • Happy Holidays

    Happy Holidays

    Just a quick note to wish all of my LinkedIn connections and followers a very happy holiday season. To you and yours…

    2 条评论
  • Get 5% Off My Latest Db2 Book for the Holidays

    Get 5% Off My Latest Db2 Book for the Holidays

    My latest book is titled "A Guide to Db2 Performance for Application Developers" and it was written to provide advice…

    2 条评论
  • DevOps is Coming to Db2 for z/OS

    DevOps is Coming to Db2 for z/OS

    Mainframe development teams are relying on DevOps practices more extensively, bringing the need to incorporate Db2 for…

    1 条评论
  • My Thoughts on Think

    My Thoughts on Think

    Last week I had the great pleasure of attending the IBM Think 2019 conference in San Francisco. There were many great…

  • IBM Think 2019: Time to Learn and Network

    IBM Think 2019: Time to Learn and Network

    I'm looking forward to once again attend the IBM Think conference, IBM's annual flagship technology event. I attended…

    3 条评论
  • IBM Db2: 35 Years Young

    IBM Db2: 35 Years Young

    It is hard to believe that IBM Db2 is 35 years old this year, but it's true! DB2 was announced on June 7, 1983, and…

    41 条评论
  • The State of the Mainframe 2018

    The State of the Mainframe 2018

    Every year BMC Software conducts a survey of mainframe usage that provides a unique insight into the trends, topics…

    2 条评论

社区洞察

其他会员也浏览了