Create and Map User-defined Functions

Guides you through the steps required to create user-defined functions in SQL Server Management Studio, and to map those functions using the HCO for SQL Server Customize Name Mappings tool.

Create user-defined functions

  1. Launch SQL Server Management Studio, and select the HCO_Test database.
  2. Navigate to and open the FunctionEmulation.sql file, located in the %PUBLIC%\Documents\Micro Focus\Enterprise Developer\Samples\Mainframe\SQL\hcoss\FunctionEmulation directory.

    This file contains a script that creates some user defined math functions needed by the example code.

  3. Click Execute.
  4. From the Object Explorer expand and select HCO_Test > Programmability > Functions > Scalar-Valued Functions and Refresh this folder. You should now see the newly created functions.

Map user-defined functions

Start HCO for SQL Server tools
  • In Eclipse, click Run > Tools > Data Tools > HCO for SQL Server.
Map the functions for HCOSS
  1. From the HCO for SQL Server interface, click Customize SQL Name Mappings.
  2. Scroll to the bottom of the grid and double-click in the first empty cell to activate it for editing. Type the following information in the appropriate rows and columns, and check the corresponding Is Function box for each:
    DB2 Function/Special Register SQL Server Equivalent
    atanh dbo.atanh
    cosh dbo.cosh
    sinh dbo.sinh
    tanh dbo.tanh
  3. Click Save to save the mappings.
  4. Close the HCO for SQL Server window.