DROP EXTERNAL FUNCTION ABS;
DROP EXTERNAL FUNCTION ACOS;
DROP EXTERNAL FUNCTION ASCII_CHAR;
DROP EXTERNAL FUNCTION ASCII_VAL;
DROP EXTERNAL FUNCTION ASIN;
DROP EXTERNAL FUNCTION ATAN;
DROP EXTERNAL FUNCTION ATAN2;
DROP EXTERNAL FUNCTION BIN_AND;
DROP EXTERNAL FUNCTION BIN_OR;
DROP EXTERNAL FUNCTION BIN_XOR;
DROP EXTERNAL FUNCTION CEILING;
DROP EXTERNAL FUNCTION COS;
DROP EXTERNAL FUNCTION COSH;
DROP EXTERNAL FUNCTION COT;
DROP EXTERNAL FUNCTION DIV;
DROP EXTERNAL FUNCTION FLOOR;
DROP EXTERNAL FUNCTION LN;
DROP EXTERNAL FUNCTION LOG;
DROP EXTERNAL FUNCTION LOG10;
DROP EXTERNAL FUNCTION LOWER;
DROP EXTERNAL FUNCTION LPAD;
DROP EXTERNAL FUNCTION LTRIM;
DROP EXTERNAL FUNCTION MOD;
DROP EXTERNAL FUNCTION PI;
DROP EXTERNAL FUNCTION RAND;
DROP EXTERNAL FUNCTION RPAD;
DROP EXTERNAL FUNCTION RTRIM;
DROP EXTERNAL FUNCTION SIGN;
DROP EXTERNAL FUNCTION SIN;
DROP EXTERNAL FUNCTION SQRT;
DROP EXTERNAL FUNCTION STRLEN;
DROP EXTERNAL FUNCTION SUBSTR;
DROP EXTERNAL FUNCTION TAN;
DROP EXTERNAL FUNCTION TANH;


/******************************************************************************/
/****                        User Defined Functions                        ****/
/******************************************************************************/

DECLARE EXTERNAL FUNCTION ABS
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION ACOS
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_acos' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION ASCII_CHAR
    INTEGER
    RETURNS CHAR(1) FREE_IT
    ENTRY_POINT 'IB_UDF_ascii_char' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION ASCII_VAL
    CHAR(1)
    RETURNS INTEGER BY VALUE
    ENTRY_POINT 'IB_UDF_ascii_val' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION ASIN
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_asin' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION ATAN
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_atan' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION ATAN2
    DOUBLE PRECISION,
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_atan2' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION BIN_AND
    INTEGER,
    INTEGER
    RETURNS INTEGER BY VALUE
    ENTRY_POINT 'IB_UDF_bin_and' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION BIN_OR
    INTEGER,
    INTEGER
    RETURNS INTEGER BY VALUE
    ENTRY_POINT 'IB_UDF_bin_or' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION BIN_XOR
    INTEGER,
    INTEGER
    RETURNS INTEGER BY VALUE
    ENTRY_POINT 'IB_UDF_bin_xor' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION CEILING
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_ceiling' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION COS
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_cos' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION COSH
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_cosh' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION COT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_cot' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION DIV
    INTEGER,
    INTEGER
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_div' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION FLOOR
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_floor' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION LN
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_ln' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION LOG
    DOUBLE PRECISION,
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_log' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION LOG10
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_log10' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION LOWER
    CSTRING(80)
    RETURNS CSTRING(80) FREE_IT
    ENTRY_POINT 'IB_UDF_lower' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION LPAD
    CSTRING(255),
    INTEGER,
    CSTRING(1)
    RETURNS CSTRING(255) FREE_IT
    ENTRY_POINT 'IB_UDF_lpad' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION LTRIM
    CSTRING(80)
    RETURNS CSTRING(80) FREE_IT
    ENTRY_POINT 'IB_UDF_ltrim' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION MOD
    INTEGER,
    INTEGER
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_mod' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION PI

    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_pi' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION RAND

    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_rand' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION RPAD
    CSTRING(255),
    INTEGER,
    CSTRING(1)
    RETURNS CSTRING(255) FREE_IT
    ENTRY_POINT 'IB_UDF_rpad' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION RTRIM
    CSTRING(80)
    RETURNS CSTRING(80) FREE_IT
    ENTRY_POINT 'IB_UDF_rtrim' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION SIGN
    DOUBLE PRECISION
    RETURNS INTEGER BY VALUE
    ENTRY_POINT 'IB_UDF_sign' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION SIN
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_sin' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION SQRT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_sqrt' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION STRLEN
    CSTRING(32767)
    RETURNS INTEGER BY VALUE
    ENTRY_POINT 'IB_UDF_strlen' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION SUBSTR
    CSTRING(80),
    SMALLINT,
    SMALLINT
    RETURNS CSTRING(80) FREE_IT
    ENTRY_POINT 'IB_UDF_substr' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION TAN
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_tan' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION TANH
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'IB_UDF_tanh' MODULE_NAME 'ib_udf';


