Function Customization Process

DB2 comes with some built-in functions that are not represented in SQL Server. If your application uses any of these built-in functions, you must define an equivalent SQL Server function for each in your SQL Server database, and map each DB2 function to its corresponding user-defined SQL Server function using HCOSS. Do these things before binding the application.

SQL Server requires that all calls to user-defined functions are qualified with the schema name of the function. You can use HCOSS to map unqualified function names to qualified function names.

The process for customizing SQL Server to emulate a non-represented DB2 function is as follows:

  1. In your SQL Server database, define a function to serve as an equivalent of the DB2 built-in function.
  2. Qualify the new function, specifying its SQL Server schema. This is necessary because SQL Server requires that all calls to user-defined functions be qualified with the schema name.
  3. In HCOSS, map the DB2 built-in function to the newly created SQL Server function.
  4. When you build the application, set the HCOSS DIALECT directive to MAINFRAME. This tells HCOSS to consult the mapping entries to find qualified SQL Server functions based on the equivalent, original DB2 function definition.