Natural and DB2

In a mainframe environment, if ADABAS is replaced with DB2, and Natural code is planned to be kept (or slightly changed) — What kind of considerations do you think it is required to bear in mind?

One consideration is READ LOGICAL statement performance. Let’s consider READ EMPLOYEES BY NAME = ‘BECKER’ THRU ‘BECKER’. Natural only passes the starting value to the database and Natural determines when to stop reading records from the database. With Adabas this statement creates a very efficient query. With DB2, the efficiency of the query may vary because only the starting value is provided to DB2 causing DB2 to develop a query result from BECKER through the last record on the table. Of course, Natural ensures that the same records are returned to the Natural program loop with Adabas or DB2, but the performance considerations are different.

To provide more consistent performance results with either Adabas or DB2, the new Natural 4 TO clause can be used; for example, READ EMPLOYEES BY NAME = ‘BECKER’ TO ‘BECKER’. When the TO clause is used, Natural passes both the starting and ending values to the database, whether it is Adabas or Natural. However, before changing all THRU clauses to TO clauses you must consider side-effects of the THRU clause that the program may have taken advantage of. For more information, consult the Natural 4 documentation. This topic is also covered in the Natural 4 Enhancements class.