Create and Map User-defined Functions

Guides you through the steps required to create user-defined functions, and to map those functions using a text editor.

Create user-defined functions

  1. Start a Windows command prompt.
  2. Navigate to the %PUBLIC%\Documents\Micro Focus\Enterprise Developer\Samples\Mainframe\SQL\hcopg\FunctionEmulation directory.
  3. Execute the FunctionEmulcation.sql script as follows using either the PostgreSQL psql utility or the pgAdmin tool:
    >psql -h DBInstanceEndpoint –p=Port –u=UserId -d HCO_Test -a -f functionemulation.sql

    The script file creates some user-defined math functions needed by the example code.

Map user-defined functions

  1. Open the FunctionEmulation.sql script in a text editor.
  2. Copy the contents of the functionemulation.xml file.
  3. Navigate to %ALLUSERSPROFILE%\Micro Focus\Enterprise Developer\hcopg, and open the DialectMappings.hcomap file.
  4. Insert the copied contents right before the end tag </NameMappingDataSet> in the DialectMappings.hcomap file and save.