In this example, we use the scenario that our migrated DB2 database uses a built-in function for math, atanh, that our SQL Server database does not support. We use Microsoft SQL Server Management Studio to create the function in the default dbo schema of our SQL Server database, and we use HCOSS to map the DB2 function to the newly created SQL Server user-defined function.
create function atanh (@in float) returns float begin return log((1 + @in) / (1 - @in)) / 2 end go
declare @x float = 0.75 select dbo.atanh(@x)
$set sql(targetdb=mssqlserver db=HCODemo dialect=mainframe, init) identification division. program-id. Program1. environment division. configuration section. data division. working-storage section. exec sql include sqlca end-exec. 01 mfsqlmessagetext pic x(200). 01 x comp-2. 01 atanh comp-2. 01 digits comp-2 procedure division. move 0.25 to x exec sql select atanh(:x) into :atanh end-exec display atanh goback.